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