Compare commits
3 Commits
5774278fb7
...
049edbf940
| Author | SHA1 | Date | |
|---|---|---|---|
| 049edbf940 | |||
| 9c7483ec51 | |||
| 7d0f8b3640 |
@ -65,6 +65,8 @@ cmm question [-t OTAGS]... [-k ATAGS]... [-x XTAGS]... [-o OUTTAGS]... [-A AI_ID
|
|||||||
* `-O, --overwrite`: Overwrite existing messages when repeating them
|
* `-O, --overwrite`: Overwrite existing messages when repeating them
|
||||||
* `-s, --source-text FILE`: Add content of a file to the query
|
* `-s, --source-text FILE`: Add content of a file to the query
|
||||||
* `-S, --source-code FILE`: Add source code file content to the chat history
|
* `-S, --source-code FILE`: Add source code file content to the chat history
|
||||||
|
* `-l, --location {disk,cache,db,all}`: Use given location when building the chat history (default: 'db')
|
||||||
|
* `-g, --glob GLOB`: Filter message files using the given glob pattern
|
||||||
|
|
||||||
#### Hist
|
#### Hist
|
||||||
|
|
||||||
|
|||||||
@ -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,10 +67,10 @@ 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='Select message location, default is \'db\'')
|
help='Use given location when building the chat history (default: \'db\')')
|
||||||
question_cmd_parser.add_argument('-g', '--glob', help='Glob for message file names')
|
question_cmd_parser.add_argument('-g', '--glob', help='Filter message files using the given glob pattern')
|
||||||
question_cmd_parser.add_argument('-O', '--overwrite', help='Overwrite existing messages when repeating them',
|
question_cmd_parser.add_argument('-O', '--overwrite', help='Overwrite existing messages when repeating them',
|
||||||
action='store_true')
|
action='store_true')
|
||||||
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-text', nargs='+', help='Add content of a file to the query', metavar='FILE')
|
||||||
@ -94,10 +94,10 @@ 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='Select message location, default is \'db\'')
|
help='Use given location when building the chat history (default: \'db\')')
|
||||||
hist_cmd_parser.add_argument('-g', '--glob', help='Glob for message file names')
|
hist_cmd_parser.add_argument('-g', '--glob', help='Filter message files using the given glob pattern')
|
||||||
|
|
||||||
# 'tags' command parser
|
# 'tags' command parser
|
||||||
tags_cmd_parser = cmdparser.add_parser('tags',
|
tags_cmd_parser = cmdparser.add_parser('tags',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user