cmm: splitted commands into separate modules (and more cleanup)

This commit is contained in:
2023-09-08 13:31:01 +02:00
parent 2df9dd6427
commit b1a23394fc
8 changed files with 196 additions and 112 deletions
+23
View File
@@ -0,0 +1,23 @@
import argparse
from pathlib import Path
from ..configuration import Config
from ..chat import ChatDB
from ..message import MessageFilter
def hist_cmd(args: argparse.Namespace, config: Config) -> None:
"""
Handler for the 'hist' command.
"""
mfilter = MessageFilter(tags_or=args.or_tags,
tags_and=args.and_tags,
tags_not=args.exclude_tags,
question_contains=args.question,
answer_contains=args.answer)
chat = ChatDB.from_dir(Path('.'),
Path(config.db),
mfilter=mfilter)
chat.print(args.source_code_only,
args.with_tags,
args.with_files)