diff options
| author | Loic Guegan <loic.guegan@mailbox.org> | 2024-04-19 14:26:58 +0200 |
|---|---|---|
| committer | Loic Guegan <loic.guegan@mailbox.org> | 2024-04-19 14:26:58 +0200 |
| commit | fd45b611986fdd36243099e6801b429eef75c2ca (patch) | |
| tree | 9d0158292536a86ea87f637576fc7c4dce23f714 /pnote/__main__.py | |
| parent | ab5c2a08c793decc450d2c2803008f0f3c43791b (diff) | |
Improve pnote API
Diffstat (limited to 'pnote/__main__.py')
| -rw-r--r-- | pnote/__main__.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/pnote/__main__.py b/pnote/__main__.py index d652ddd..c5c2ede 100644 --- a/pnote/__main__.py +++ b/pnote/__main__.py @@ -1,6 +1,7 @@ #!/usr/bin/env python import os, argparse +from pathlib import Path from pnote.project import * from pnote.tools import * from pnote import __version__ @@ -11,9 +12,9 @@ def main(): prog='PNote', description='Note management tool', epilog='pnote v'+__version__) - parser.add_argument('path', help="Path to a pnote project") parser.add_argument('-t', '--today', help="Open today's note file", action="store_true") parser.add_argument('-o', '--open', help="Open specific note file") + parser.add_argument('-d', '--dir', help="Project directory") subparsers = parser.add_subparsers(dest="tool", help='Tool to use') # Tools @@ -30,7 +31,12 @@ def main(): args = parser.parse_args() ## Load project - project=Project(args.path) + if args.dir: + project=Project(args.dir) + else: + pdir=Path.home()/".pnote/" + pdir.mkdir(parents=True, exist_ok=True) + project=Project(pdir) ## Run tool if args.tool == "search": |
