Coverage for src/zettel/cli.py: 100%

1 import argparse

2 from .notebook import Notebook

3 from zettel import notebook

4 import sys

5

6 def main(argv=None):

7 parser = argparse.ArgumentParser()

8 parser.add_argument('--dir')

9 parser.add_argument('title')

10 args = parser.parse_args(argv)

11

12 if sys.stdin.isatty():

13 notebook = Notebook(args.dir)

14 else:

15 files = sys.stdin.read().splitlines()

16 notebook = Notebook(args.dir, notes = files)

17

18 note = notebook.get_note_by_title(args.title)

19

20 if note is not None:

21 print(note.path)

22

23 if __name__ == '__main__':

24 main()