From 7277eb5dc0119015387abb19ac4c3a06fdc56950 Mon Sep 17 00:00:00 2001 From: juk0de Date: Wed, 20 Sep 2023 08:48:59 +0200 Subject: [PATCH] main: improved metavar names and descriptions --- chatmastermind/main.py | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/chatmastermind/main.py b/chatmastermind/main.py index fcd1b2f..418dafc 100755 --- a/chatmastermind/main.py +++ b/chatmastermind/main.py @@ -44,13 +44,13 @@ def create_parser() -> argparse.ArgumentParser: help='List of tags to exclude', metavar='XTAGS') etag_arg.completer = tags_completer # type: ignore otag_arg = tag_parser.add_argument('-o', '--output-tags', nargs='+', - help='List of output tags (default: use input tags)', metavar='OUTTAGS') + help='List of output tags (default: use input tags)', metavar='OUTAGS') otag_arg.completer = tags_completer # type: ignore # a parent parser for all commands that support AI configuration ai_parser = argparse.ArgumentParser(add_help=False) - ai_parser.add_argument('-A', '--AI', help='AI ID to use') - ai_parser.add_argument('-M', '--model', help='Model to use') + ai_parser.add_argument('-A', '--AI', help='AI ID to use', metavar='AI_ID') + ai_parser.add_argument('-M', '--model', help='Model to use', metavar='MODEL') ai_parser.add_argument('-n', '--num-answers', help='Number of answers to request', type=int, default=1) ai_parser.add_argument('-m', '--max-tokens', help='Max. nr. of tokens', type=int) ai_parser.add_argument('-T', '--temperature', help='Temperature value', type=float) @@ -61,14 +61,15 @@ def create_parser() -> argparse.ArgumentParser: aliases=['q']) question_cmd_parser.set_defaults(func=question_cmd) question_group = question_cmd_parser.add_mutually_exclusive_group(required=True) - question_group.add_argument('-a', '--ask', nargs='+', help='Ask a question') - question_group.add_argument('-c', '--create', nargs='+', help='Create a question') - question_group.add_argument('-r', '--repeat', nargs='*', help='Repeat a question') - question_group.add_argument('-p', '--process', nargs='*', help='Process existing questions') + question_group.add_argument('-a', '--ask', nargs='+', help='Ask a question', metavar='QUESTION') + question_group.add_argument('-c', '--create', nargs='+', help='Create a question', metavar='QUESTION') + question_group.add_argument('-r', '--repeat', nargs='*', help='Repeat a question', metavar='MESSAGE') + question_group.add_argument('-p', '--process', nargs='*', help='Process existing questions', metavar='MESSAGE') question_cmd_parser.add_argument('-O', '--overwrite', help='Overwrite existing messages when repeating them', action='store_true') - question_cmd_parser.add_argument('-s', '--source-text', nargs='+', help='Add content of a file to the query') - question_cmd_parser.add_argument('-S', '--source-code', nargs='+', help='Add source code file content to the chat history') + question_cmd_parser.add_argument('-s', '--source-text', nargs='+', help='Add content of a file to the query', metavar='FILE') + question_cmd_parser.add_argument('-S', '--source-code', nargs='+', help='Add source code file content to the chat history', + metavar='FILE') # 'hist' command parser hist_cmd_parser = cmdparser.add_parser('hist', parents=[tag_parser], @@ -79,10 +80,10 @@ def create_parser() -> argparse.ArgumentParser: action='store_true') hist_cmd_parser.add_argument('-W', '--with-files', help="Print chat history with filenames.", action='store_true') - hist_cmd_parser.add_argument('-S', '--source-code-only', help='Print only source code', + hist_cmd_parser.add_argument('-S', '--source-code-only', help='Only print embedded source code', action='store_true') - hist_cmd_parser.add_argument('-A', '--answer', help='Search for answer substring') - hist_cmd_parser.add_argument('-Q', '--question', help='Search for question substring') + hist_cmd_parser.add_argument('-A', '--answer', help='Search for answer substring', metavar='SUBSTRING') + hist_cmd_parser.add_argument('-Q', '--question', help='Search for question substring', metavar='SUBSTRING') # 'tags' command parser tags_cmd_parser = cmdparser.add_parser('tags', @@ -92,8 +93,8 @@ def create_parser() -> argparse.ArgumentParser: tags_group = tags_cmd_parser.add_mutually_exclusive_group(required=True) tags_group.add_argument('-l', '--list', help="List all tags and their frequency", action='store_true') - tags_cmd_parser.add_argument('-p', '--prefix', help="Filter tags by prefix") - tags_cmd_parser.add_argument('-c', '--contain', help="Filter tags by contained substring") + tags_cmd_parser.add_argument('-p', '--prefix', help="Filter tags by prefix", metavar='PREFIX') + tags_cmd_parser.add_argument('-c', '--contain', help="Filter tags by contained substring", metavar='SUBSTRING') # 'config' command parser config_cmd_parser = cmdparser.add_parser('config', @@ -106,18 +107,18 @@ def create_parser() -> argparse.ArgumentParser: action='store_true') config_group.add_argument('-m', '--print-model', help="Print the currently configured model", action='store_true') - config_group.add_argument('-c', '--create', help="Create config with default settings in the given file") + config_group.add_argument('-c', '--create', help="Create config with default settings in the given file", metavar='FILE') # 'print' command parser print_cmd_parser = cmdparser.add_parser('print', help="Print message files.", aliases=['p']) print_cmd_parser.set_defaults(func=print_cmd) - print_cmd_parser.add_argument('-f', '--file', help='File to print', required=True) + print_cmd_parser.add_argument('-f', '--file', help='Print given message file', required=True, metavar='FILE') print_cmd_modes = print_cmd_parser.add_mutually_exclusive_group() - print_cmd_modes.add_argument('-q', '--question', help='Print only question', action='store_true') - print_cmd_modes.add_argument('-a', '--answer', help='Print only answer', action='store_true') - print_cmd_modes.add_argument('-S', '--only-source-code', help='Print only source code', action='store_true') + print_cmd_modes.add_argument('-q', '--question', help='Only print the question', action='store_true') + print_cmd_modes.add_argument('-a', '--answer', help='Only print the answer', action='store_true') + print_cmd_modes.add_argument('-S', '--only-source-code', help='Only print embedded source code', action='store_true') argcomplete.autocomplete(parser) return parser