cmm: limited the message locations for the new cmm parameters to those that make sense
This commit is contained in:
parent
9c7483ec51
commit
049edbf940
@ -325,6 +325,8 @@ class ChatDB(Chat):
|
|||||||
when reading them.
|
when reading them.
|
||||||
* 'loc': read messages from given location instead of 'db_path'
|
* 'loc': read messages from given location instead of 'db_path'
|
||||||
"""
|
"""
|
||||||
|
if loc == msg_location.MEM:
|
||||||
|
raise ChatError(f"Can't build ChatDB from message location '{loc}'")
|
||||||
messages: list[Message] = []
|
messages: list[Message] = []
|
||||||
if loc in [msg_location.DB, msg_location.DISK, msg_location.ALL]:
|
if loc in [msg_location.DB, msg_location.DISK, msg_location.ALL]:
|
||||||
messages.extend(read_dir(db_path, glob, mfilter))
|
messages.extend(read_dir(db_path, glob, mfilter))
|
||||||
|
|||||||
@ -67,7 +67,7 @@ def create_parser() -> argparse.ArgumentParser:
|
|||||||
question_group.add_argument('-r', '--repeat', nargs='*', help='Repeat a question', metavar='MESSAGE')
|
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_group.add_argument('-p', '--process', nargs='*', help='Process existing questions', metavar='MESSAGE')
|
||||||
question_cmd_parser.add_argument('-l', '--location',
|
question_cmd_parser.add_argument('-l', '--location',
|
||||||
choices=[x.value for x in msg_location],
|
choices=[x.value for x in msg_location if x not in [msg_location.MEM, msg_location.DISK]],
|
||||||
default='db',
|
default='db',
|
||||||
help='Use given location when building the chat history (default: \'db\')')
|
help='Use given location when building the chat history (default: \'db\')')
|
||||||
question_cmd_parser.add_argument('-g', '--glob', help='Filter message files using the given glob pattern')
|
question_cmd_parser.add_argument('-g', '--glob', help='Filter message files using the given glob pattern')
|
||||||
@ -94,7 +94,7 @@ def create_parser() -> argparse.ArgumentParser:
|
|||||||
hist_cmd_parser.add_argument('-d', '--tight', help='Print without message separators', action='store_true')
|
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('-P', '--no-paging', help='Print without paging', action='store_true')
|
||||||
hist_cmd_parser.add_argument('-l', '--location',
|
hist_cmd_parser.add_argument('-l', '--location',
|
||||||
choices=[x.value for x in msg_location],
|
choices=[x.value for x in msg_location if x not in [msg_location.MEM, msg_location.DISK]],
|
||||||
default='db',
|
default='db',
|
||||||
help='Use given location when building the chat history (default: \'db\')')
|
help='Use given location when building the chat history (default: \'db\')')
|
||||||
hist_cmd_parser.add_argument('-g', '--glob', help='Filter message files using the given glob pattern')
|
hist_cmd_parser.add_argument('-g', '--glob', help='Filter message files using the given glob pattern')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user