diff --git a/README.md b/README.md index 5832990..513bc02 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ source ~/.kb_alias ``` **Tip** for Windows users: Do not use notepad as %EDITOR%, kb is not -compatible with notepad, a reasonable alternative is notepadd++. +compatible with notepad, a reasonable alternative is notepad++. ## USAGE diff --git a/TODO.md b/TODO.md index b60a2bc..ef6f9f0 100644 --- a/TODO.md +++ b/TODO.md @@ -1,5 +1,6 @@ # TODO List +- add option to export only data directory containing cheatsheet - Write installation procedure for Windows - Fix windows hell with automatic extensions... - find a way to include complex artifacts diff --git a/kb/cl_parser.py b/kb/cl_parser.py index 3507b5e..5954d7a 100755 --- a/kb/cl_parser.py +++ b/kb/cl_parser.py @@ -145,49 +145,6 @@ def parse_args(args): default=False, ) - # update parser - update_parser.add_argument( - "-i", "--id", - help="ID of the artifact to update", - type=str, - ) - update_parser.add_argument( - "-t", "--title", - help="Title to update", - default=None, - type=str, - ) - update_parser.add_argument( - "-c", "--category", - help="Category to update", - default=None, - type=str, - ) - update_parser.add_argument( - "-g", "--tags", - help="Tags to update in the form \"tag1;tag2;...;tagN\"", - default=None, - type=str, - ) - update_parser.add_argument( - "-a", "--author", - help="Author to update", - default=None, - type=str, - ) - update_parser.add_argument( - "-s", "--status", - help="Status to update", - default=None, - type=str, - ) - update_parser.add_argument( - "-x", "--edit-content", - help="Edit content of the artifact", - default=None, - type=str, - ) - # list parser list_parser.add_argument( "query", @@ -237,26 +194,6 @@ def parse_args(args): default=False, ) - # delete parser - delete_parser.add_argument( - "-i", "--id", - help="ID of the artifact", - type=str, - nargs='*', - ) - delete_parser.add_argument( - "-t", "--title", - help="Title of the artifact to remove", - default=None, - type=str, - ) - delete_parser.add_argument( - "-c", "--category", - help="Category associated to the artifact to remove", - default=None, - type=str, - ) - # view parser view_parser.add_argument( "-i", "--id", @@ -349,13 +286,67 @@ def parse_args(args): default=False, ) - # erase parser - erase_parser.add_argument( - "--db", - help="Only remove kb database", - action='store_true', - dest='db', - default=False, + # update parser + update_parser.add_argument( + "-i", "--id", + help="ID of the artifact to update", + type=str, + ) + update_parser.add_argument( + "-t", "--title", + help="Title to update", + default=None, + type=str, + ) + update_parser.add_argument( + "-c", "--category", + help="Category to update", + default=None, + type=str, + ) + update_parser.add_argument( + "-g", "--tags", + help="Tags to update in the form \"tag1;tag2;...;tagN\"", + default=None, + type=str, + ) + update_parser.add_argument( + "-a", "--author", + help="Author to update", + default=None, + type=str, + ) + update_parser.add_argument( + "-s", "--status", + help="Status to update", + default=None, + type=str, + ) + update_parser.add_argument( + "-x", "--edit-content", + help="Edit content of the artifact", + default=None, + type=str, + ) + + # delete parser + delete_parser.add_argument( + "-i", "--id", + help="ID of the artifact", + type=str, + nargs='*', + ) + delete_parser.add_argument( + "-t", "--title", + help="Title of the artifact to remove", + default=None, + type=str, + ) + delete_parser.add_argument( + "-c", "--category", + help="Category associated to the artifact to remove", + default=None, + type=str, ) # import parser @@ -373,6 +364,15 @@ def parse_args(args): nargs="?" ) + # erase parser + erase_parser.add_argument( + "--db", + help="Only remove kb database", + action='store_true', + dest='db', + default=False, + ) + if len(args) == 0: parser.print_help(sys.stderr) sys.exit(1) diff --git a/kb/commands/add.py b/kb/commands/add.py index 93f9236..a46ef0e 100644 --- a/kb/commands/add.py +++ b/kb/commands/add.py @@ -68,7 +68,7 @@ def add(args: Dict[str, str], config: Dict[str, str]): if not db.is_artifact_existing(conn, title, category): # If a file is provided, copy the file to kb directory # otherwise open up the editor and create some content - call([config["EDITOR"], Path(category_path, title)]) + call([config["EDITOR"], Path(category_path, title)], shell=True) new_artifact = Artifact( id=None, title=title, category=category, diff --git a/kb/commands/edit.py b/kb/commands/edit.py index 2116922..c3f1654 100644 --- a/kb/commands/edit.py +++ b/kb/commands/edit.py @@ -46,7 +46,7 @@ def edit(args: Dict[str, str], config: Dict[str, str]): category_path = Path(config["PATH_KB_DATA"], artifact.category) - call([config["EDITOR"], Path(category_path, artifact.title)]) + call([config["EDITOR"], Path(category_path, artifact.title)], shell=True) # else if a title is specified elif args["title"]: