From: martin f. krafft Date: Fri, 25 Aug 2023 04:12:13 +0000 (+1200) Subject: buildmimetree.py: consistent use of pathlib in the CLI X-Git-Url: https://git.madduck.net/etc/neomutt.git/commitdiff_plain/2fa1e4c1aec3affdf63c08a2e1d7005829cab88f?ds=sidebyside buildmimetree.py: consistent use of pathlib in the CLI --- diff --git a/.config/neomutt/buildmimetree.py b/.config/neomutt/buildmimetree.py index 1adfe5d..0052632 100755 --- a/.config/neomutt/buildmimetree.py +++ b/.config/neomutt/buildmimetree.py @@ -69,8 +69,7 @@ def parse_cli_args(*args, **kwargs): if _PYNLINER: parser.add_argument( "--css-file", - type=str, - default="", + type=pathlib.Path, help="CSS file to merge with the final HTML", ) else: @@ -106,7 +105,7 @@ def parse_cli_args(*args, **kwargs): parser.add_argument( "--tempdir", - default=None, + type=pathlib.Path, help="Specify temporary directory to use for attachments", ) @@ -126,6 +125,7 @@ def parse_cli_args(*args, **kwargs): "-o", metavar="PATH", dest="cmdpath", + type=pathlib.Path, required=True, help="Temporary file path to write commands to", ) @@ -139,6 +139,7 @@ def parse_cli_args(*args, **kwargs): massage_p.add_argument( "MAILDRAFT", nargs="?", + type=pathlib.Path, help="If provided, the script is invoked as editor on the mail draft", ) @@ -718,7 +719,7 @@ if __name__ == "__main__": ) as cmd_f: do_massage( draft_f, - pathlib.Path(args.MAILDRAFT), + args.MAILDRAFT, cmd_f, extensions=args.extensions, cssfile=args.css_file,