more help

This commit is contained in:
Michael Rodin 2022-11-24 23:40:18 +01:00
parent 809619eb83
commit 19c80e6799

View file

@ -565,24 +565,52 @@ def delete(args):
return 1 return 1
tb.delete_index(sel) tb.delete_index(sel)
def help(typ="",extended=False): # TODO: Implement extended help with examples def help(args):
syntax=False
for arg in args:
if not syntax and not re.match('[mM]',arg):
print("SYNTAX: image-index <option> [args]") print("SYNTAX: image-index <option> [args]")
syntax=True
if re.match('[aA].*',arg):
print("add:\tadds a new entry;\n\tInstant: image-index add <filepath> <category> <title> <source> <tags> <content>")
print("\tPrompt: image-index add")
print('EXAMPLES:\nimage-index add ~/Pictures/example.jpg "A Category" "Example file" "https://example.org" "Tag,Example,Some thing" "This is an example for the add option."')
print("image-index add ~/Videos/movie.mp4 (This will ask for the other options in a prompt)\n")
elif re.match('[mM].*',arg):
meta_help()
elif re.match('[cC].*',arg):
print("check:\tchecks the existence and correctness of all files in the index;\n\tSyntax: image-index check [options]")
print("\tOptions: -v: show every faulty/orphaned entry")
print("\t\t -f: check only if files exist (disables the other check)")
print("\t\t -h: check only if hashes are correct (disables the other check)\n")
elif re.match('[dD].*',arg):
print("delete:\tdeletes a file and entry based on a search query;\n\tInstant: image-index delete <words/filters>")
print("\tPrompt: image-index delete")
print("EXAMPLE:\nimage-index delete -t Example -g Tag Example -a .mp4 add\n")
elif re.match('[oO].*',arg):
print("open:\topens a file based on a search query in the standard app;\n\tInstant: image-index open <words/filters>")
print("\tPrompt: image-index open")
print("EXAMPLE:\nimage-index open example -s example.org -i an example\n")
elif re.match('[sS].*',arg):
print("show:\tsearches through the index and shows the matches (use prompt for list of filters);\n\tInstant: image-index show <words/filters>")
print("\tPrompt: image-index show")
print("EXAMPLE:\nimage-index show example -c category\n")
elif re.match('[uU].*',arg):
print("update:\tchanges specific column based on a search query;\n\tInstant: image-index update <column> <updated_value> <words/filters>")
print("\tPrompt: image-index update")
print('EXAMPLES:\nimage-index update category "New Category" -t example')
print('image-index update Tags "Tag,Example,Test" -s https:// -a example')
print('image-index update title "Some new title" -g "some thing" -a an example\n')
if not args:
print("OPTIONS:\n\thelp:\tdisplays this text") print("OPTIONS:\n\thelp:\tdisplays this text")
print("\t\tadd one of the other options to see more info.")
print("\tmeta:\tdisplays help for the metadata tables") print("\tmeta:\tdisplays help for the metadata tables")
print("\tadd:\tadds a new entry;\n\t\tInstant: image-index add <filepath> <category> <title> <source> <tags> <content>") print("\tadd:\tadds a new entry;\n\t\tSyntax: image-index add <filepath> <category> <title> <source> <tags> <content>")
print("\t\tPrompt: image-index add")
print("\tcheck:\tchecks the existence and correctness of all files in the index;\n\t\tSyntax: image-index check [options]") print("\tcheck:\tchecks the existence and correctness of all files in the index;\n\t\tSyntax: image-index check [options]")
print("\t\tOptions: -v: show every faulty/orphaned entry") print("\tdelete:\tdeletes a file and entry based on a search query;\n\t\tSyntax: image-index delete <words/filters>")
print("\t\t\t -f: check only if files exist (disables the other check)") print("\topen:\topens a file based on a search query in the standard app;\n\t\tSyntax: image-index open <words/filters>")
print("\t\t\t -h: check only if hashes are correct (disables the other check)") print("\tshow:\tsearches through the index and shows the matches;\n\t\tSyntax: image-index show <words/filters>")
print("\tdelete:\tdeletes a file and entry based on a search query;\n\t\tInstant: image-index delete <words/filters>") print("\tupdate:\tchanges specific column based on a search query;\n\t\tSyntax: image-index update <column> <updated_value> <words/filters>")
print("\t\tPrompt: image-index delete")
print("\topen:\topens a file based on a search query in the standard app;\n\t\tInstant: image-index open <words/filters>")
print("\t\tPrompt: image-index open")
print("\tshow:\tsearches through the index and shows the matches (use prompt for list of filters);\n\t\tInstant: image-index show <words/filters>")
print("\t\tPrompt: image-index show")
print("\tupdate:\tchanges specific column based on a search query;\n\t\tInstant: image-index update <column> <updated_value> <words/filters>")
print("\t\tPrompt: image-index update")
def meta(args): def meta(args):
if len(args) == 0 or re.match('[hH].*',args[0]): if len(args) == 0 or re.match('[hH].*',args[0]):
@ -655,6 +683,8 @@ def meta_help():
print("OPTIONS:\n\thelp:\tdisplays this text") print("OPTIONS:\n\thelp:\tdisplays this text")
print("\tcheck:\tcheck which items don't have an entry yet;\n\t\tSyntax: image-index meta check <Category/Tags>") print("\tcheck:\tcheck which items don't have an entry yet;\n\t\tSyntax: image-index meta check <Category/Tags>")
print("\tupdate:\tchange an alias of one entry based on a search query;\n\t\tSyntax: image-index update <Category/Tags> [entry] [alias]") print("\tupdate:\tchange an alias of one entry based on a search query;\n\t\tSyntax: image-index update <Category/Tags> [entry] [alias]")
print('\t\tExample: image-index meta update tags Example "New alias"')
print('\t\t\t image-index meta update category "A Category" "Example Category"\n')
def sopen(args): def sopen(args):
plat=sys.platform plat=sys.platform
@ -746,7 +776,7 @@ def show(args):
def main(): def main():
if len(sys.argv) <= 1 or re.match('[hH].*',sys.argv[1]): if len(sys.argv) <= 1 or re.match('[hH].*',sys.argv[1]):
help() help(sys.argv[2:])
else: else:
command=sys.argv[1] command=sys.argv[1]
args=[] args=[]