]> git.madduck.net Git - etc/neomutt.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

buildmimetree.py: consistent use of pathlib in the CLI
authormartin f. krafft <madduck@madduck.net>
Fri, 25 Aug 2023 04:12:13 +0000 (16:12 +1200)
committermartin f. krafft <madduck@madduck.net>
Fri, 25 Aug 2023 04:12:13 +0000 (16:12 +1200)
.config/neomutt/buildmimetree.py

index 1adfe5d864f976520ba20d187c93e8d292c516fd..00526327ddca23a14446c9901d214eb368b6b2fe 100755 (executable)
@@ -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,