Add --glob and --location flags to hist and question commands, to be able to specify the location and files they should use.

This commit is contained in:
Oleksandr Kozachuk
2023-10-19 16:03:51 +02:00
parent 9a493b57da
commit 114282dfd8
6 changed files with 29 additions and 5 deletions
+11
View File
@@ -14,6 +14,7 @@ from .commands.tags import tags_cmd
from .commands.config import config_cmd
from .commands.hist import hist_cmd
from .commands.print import print_cmd
from .chat import msg_location
def tags_completer(prefix: str, parsed_args: Any, **kwargs: Any) -> list[str]:
@@ -65,6 +66,11 @@ def create_parser() -> argparse.ArgumentParser:
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('-l', '--location',
choices=[x.value for x in msg_location],
default='db',
help='Select message location, default is \'db\'')
question_cmd_parser.add_argument('-g', '--glob', help='Glob for message file names')
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', metavar='FILE')
@@ -87,6 +93,11 @@ def create_parser() -> argparse.ArgumentParser:
hist_cmd_parser.add_argument('-Q', '--question', help='Print only questions with given substring', metavar='SUBSTRING')
hist_cmd_parser.add_argument('-d', '--tight', help='Print without message separators', action='store_true')
hist_cmd_parser.add_argument('-P', '--no-paging', help='Print without paging', action='store_true')
hist_cmd_parser.add_argument('-l', '--location',
choices=[x.value for x in msg_location],
default='db',
help='Select message location, default is \'db\'')
hist_cmd_parser.add_argument('-g', '--glob', help='Glob for message file names')
# 'tags' command parser
tags_cmd_parser = cmdparser.add_parser('tags',