Compare commits
3 Commits
049edbf940
...
5774278fb7
| Author | SHA1 | Date | |
|---|---|---|---|
| 5774278fb7 | |||
| 40d0de50de | |||
| 72d31c26e9 |
@ -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
|
||||
* `-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
|
||||
* `-l, --location {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
|
||||
|
||||
@ -83,6 +85,8 @@ cmm hist [--print | --convert FORMAT] [-t OTAGS]... [-k ATAGS]... [-x XTAGS]...
|
||||
* `-S, --source-code-only`: Only print embedded source code
|
||||
* `-A, --answer SUBSTRING`: Filter for answer substring
|
||||
* `-Q, --question SUBSTRING`: Filter for question substring
|
||||
* `-l, --location {cache,db,all}`: Use given location when building the chat history (default: 'db')
|
||||
* `-g, --glob GLOB`: Filter message files using the given glob pattern
|
||||
|
||||
#### Tags
|
||||
|
||||
|
||||
@ -325,6 +325,8 @@ class ChatDB(Chat):
|
||||
when reading them.
|
||||
* '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] = []
|
||||
if loc in [msg_location.DB, msg_location.DISK, msg_location.ALL]:
|
||||
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('-p', '--process', nargs='*', help='Process existing questions', metavar='MESSAGE')
|
||||
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',
|
||||
help='Select message location, default is \'db\'')
|
||||
question_cmd_parser.add_argument('-g', '--glob', help='Glob for message file names')
|
||||
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('-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')
|
||||
@ -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('-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],
|
||||
choices=[x.value for x in msg_location if x not in [msg_location.MEM, msg_location.DISK]],
|
||||
default='db',
|
||||
help='Select message location, default is \'db\'')
|
||||
hist_cmd_parser.add_argument('-g', '--glob', help='Glob for message file names')
|
||||
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')
|
||||
|
||||
# 'tags' command parser
|
||||
tags_cmd_parser = cmdparser.add_parser('tags',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user