Esempio n. 1
0
def test_single_file():
    """
    test that a single zsh parse works and for an entry in the history
    """
    def zsh_small_test():
        yield Path(history_file)

    items = list(history(from_paths=zsh_small_test))
    assert len(items) == 11

    from datetime import datetime, timezone

    # from the test history file, fine to do
    e = Entry(
        dt=datetime(
            year=2020,
            month=7,
            day=14,
            hour=2,
            minute=21,
            second=37,
            tzinfo=timezone.utc,
        ),
        duration=0,
        command="ls",
    )
    assert e in items
Esempio n. 2
0
def test_overlap():
    """
    To make sure that duplicates are removed
    """
    def zsh_multiple_tests():
        yield Path(history_file)
        yield Path(overlap_file)

    items = list(history(from_paths=zsh_multiple_tests))
    assert len(items) == 11
Esempio n. 3
0
def index() -> Results:
    from my.zsh import history

    for e in history():
        for u in iter_urls(e.command):
            yield Visit(
                url=u,
                dt=e.dt,
                context=e.command,
                locator=Loc(title=e.command, href=u),
                duration=e.duration,
            )