24 lines
769 B
Python
24 lines
769 B
Python
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(config.cache),
|
|
Path(config.db),
|
|
mfilter=mfilter)
|
|
chat.print(args.source_code_only,
|
|
args.with_tags,
|
|
args.with_files)
|