Compare commits
2 Commits
ddbb8df5c4
...
472d2832ac
| Author | SHA1 | Date | |
|---|---|---|---|
| 472d2832ac | |||
| e120998930 |
@ -61,9 +61,9 @@ def create_question_with_hist(args: argparse.Namespace,
|
|||||||
return chat, full_question, tags
|
return chat, full_question, tags
|
||||||
|
|
||||||
|
|
||||||
def tag_cmd(args: argparse.Namespace, config: Config) -> None:
|
def tags_cmd(args: argparse.Namespace, config: Config) -> None:
|
||||||
"""
|
"""
|
||||||
Handler for the 'tag' command.
|
Handler for the 'tags' command.
|
||||||
"""
|
"""
|
||||||
chat = ChatDB.from_dir(cache_path=pathlib.Path('.'),
|
chat = ChatDB.from_dir(cache_path=pathlib.Path('.'),
|
||||||
db_path=pathlib.Path(config.db))
|
db_path=pathlib.Path(config.db))
|
||||||
@ -197,16 +197,16 @@ def create_parser() -> argparse.ArgumentParser:
|
|||||||
hist_cmd_parser.add_argument('-S', '--source-code-only', help='Print only source code',
|
hist_cmd_parser.add_argument('-S', '--source-code-only', help='Print only source code',
|
||||||
action='store_true')
|
action='store_true')
|
||||||
|
|
||||||
# 'tag' command parser
|
# 'tags' command parser
|
||||||
tag_cmd_parser = cmdparser.add_parser('tag',
|
tags_cmd_parser = cmdparser.add_parser('tags',
|
||||||
help="Manage tags.",
|
help="Manage tags.",
|
||||||
aliases=['t'])
|
aliases=['t'])
|
||||||
tag_cmd_parser.set_defaults(func=tag_cmd)
|
tags_cmd_parser.set_defaults(func=tags_cmd)
|
||||||
tag_group = tag_cmd_parser.add_mutually_exclusive_group(required=True)
|
tags_group = tags_cmd_parser.add_mutually_exclusive_group(required=True)
|
||||||
tag_group.add_argument('-l', '--list', help="List all tags and their frequency",
|
tags_group.add_argument('-l', '--list', help="List all tags and their frequency",
|
||||||
action='store_true')
|
action='store_true')
|
||||||
tag_cmd_parser.add_argument('-p', '--prefix', help="Filter tags by prefix")
|
tags_cmd_parser.add_argument('-p', '--prefix', help="Filter tags by prefix")
|
||||||
tag_cmd_parser.add_argument('-c', '--contain', help="Filter tags by contained substring")
|
tags_cmd_parser.add_argument('-c', '--contain', help="Filter tags by contained substring")
|
||||||
|
|
||||||
# 'config' command parser
|
# 'config' command parser
|
||||||
config_cmd_parser = cmdparser.add_parser('config',
|
config_cmd_parser = cmdparser.add_parser('config',
|
||||||
|
|||||||
@ -230,7 +230,7 @@ class TestCreateParser(CmmTestCase):
|
|||||||
mock_add_subparsers.assert_called_once_with(dest='command', title='commands', description='supported commands', required=True)
|
mock_add_subparsers.assert_called_once_with(dest='command', title='commands', description='supported commands', required=True)
|
||||||
mock_cmdparser.add_parser.assert_any_call('ask', parents=ANY, help=ANY, aliases=ANY)
|
mock_cmdparser.add_parser.assert_any_call('ask', parents=ANY, help=ANY, aliases=ANY)
|
||||||
mock_cmdparser.add_parser.assert_any_call('hist', parents=ANY, help=ANY, aliases=ANY)
|
mock_cmdparser.add_parser.assert_any_call('hist', parents=ANY, help=ANY, aliases=ANY)
|
||||||
mock_cmdparser.add_parser.assert_any_call('tag', help=ANY, aliases=ANY)
|
mock_cmdparser.add_parser.assert_any_call('tags', help=ANY, aliases=ANY)
|
||||||
mock_cmdparser.add_parser.assert_any_call('config', help=ANY, aliases=ANY)
|
mock_cmdparser.add_parser.assert_any_call('config', help=ANY, aliases=ANY)
|
||||||
mock_cmdparser.add_parser.assert_any_call('print', help=ANY, aliases=ANY)
|
mock_cmdparser.add_parser.assert_any_call('print', help=ANY, aliases=ANY)
|
||||||
self.assertTrue('.config.yaml' in parser.get_default('config'))
|
self.assertTrue('.config.yaml' in parser.get_default('config'))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user