From 54ece6efeb23f36fa6ffc156ed5dc3d97ec83752 Mon Sep 17 00:00:00 2001 From: Oleksandr Kozachuk Date: Sat, 9 Sep 2023 15:38:40 +0200 Subject: [PATCH] Port print arguments -q/-a/-S from main to restructuring. --- chatmastermind/commands/print.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/chatmastermind/commands/print.py b/chatmastermind/commands/print.py index 51e76f8..3d2b990 100644 --- a/chatmastermind/commands/print.py +++ b/chatmastermind/commands/print.py @@ -13,7 +13,15 @@ def print_cmd(args: argparse.Namespace, config: Config) -> None: try: message = Message.from_file(fname) if message: - print(message.to_str(source_code_only=args.source_code_only)) + if args.question: + print(message.question) + elif args.answer: + print(message.answer) + elif message.answer and args.only_source_code: + for code in message.answer.source_code(): + print(code) + else: + print(message.to_str()) except MessageError: print(f"File is not a valid message: {args.file}") sys.exit(1)