Compare commits
4 Commits
a33f6afd5f
...
472d2832ac
| Author | SHA1 | Date | |
|---|---|---|---|
| 472d2832ac | |||
| e120998930 | |||
| 124d89f212 | |||
| 88766dd5ae |
@ -145,9 +145,12 @@ class Chat:
|
||||
"""
|
||||
return sum(m.tokens() for m in self.messages)
|
||||
|
||||
def print(self, source_code_only: bool = False,
|
||||
def print(self, dump: bool = False, source_code_only: bool = False,
|
||||
with_tags: bool = False, with_files: bool = False,
|
||||
paged: bool = True) -> None:
|
||||
if dump:
|
||||
pp(self)
|
||||
return
|
||||
output: list[str] = []
|
||||
for message in self.messages:
|
||||
if source_code_only:
|
||||
|
||||
@ -116,7 +116,8 @@ def hist_cmd(args: argparse.Namespace, config: Config) -> None:
|
||||
chat = ChatDB.from_dir(pathlib.Path('.'),
|
||||
pathlib.Path(config.db),
|
||||
mfilter=mfilter)
|
||||
chat.print(args.source_code_only,
|
||||
chat.print(args.dump,
|
||||
args.source_code_only,
|
||||
args.with_tags,
|
||||
args.with_files)
|
||||
|
||||
@ -187,6 +188,8 @@ def create_parser() -> argparse.ArgumentParser:
|
||||
help="Print chat history.",
|
||||
aliases=['h'])
|
||||
hist_cmd_parser.set_defaults(func=hist_cmd)
|
||||
hist_cmd_parser.add_argument('-d', '--dump', help="Print chat history as Python structure",
|
||||
action='store_true')
|
||||
hist_cmd_parser.add_argument('-w', '--with-tags', help="Print chat history with tags.",
|
||||
action='store_true')
|
||||
hist_cmd_parser.add_argument('-W', '--with-files', help="Print chat history with filenames.",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user