]> git.armaanb.net Git - bin.git/commitdiff
Fix args.mkdir logic
authorArmaan Bhojwani <me@armaanb.net>
Tue, 5 Jan 2021 02:48:49 +0000 (21:48 -0500)
committerArmaan Bhojwani <me@armaanb.net>
Tue, 5 Jan 2021 02:48:49 +0000 (21:48 -0500)
upl

diff --git a/upl b/upl
index c1b6051512b71d3fe1651429ca052d37b68a9df3..5a428c94ff899ba95940fb1ffc3520b0b9b026b3 100755 (executable)
--- a/upl
+++ b/upl
@@ -8,16 +8,13 @@ from shutil import copyfile
 def parse_args():
     parser = argparse.ArgumentParser(
         description="Copy file to Wasabi-mounted directory")
-    parser.add_argument("input", metavar="inp", type=str, nargs="+",
-                    help="input file")
-    parser.add_argument("output", metavar="outp", type=str, nargs="*",
-                    help="output path")
-    parser.add_argument("-p", "--private",
-                        action="store_true",
+    parser.add_argument("input", type=str, nargs=1, help="input file")
+    parser.add_argument("output", type=str, nargs="*", help="output path")
+    parser.add_argument("-p", "--private", action="store_true",
                         help="Copy to private directory")
-    parser.add_argument("-m", "--mkdir",
-                        action="store_true",
+    parser.add_argument("-m", "--mkdir", action="store_true",
                         help="Create parent directories if necesary")
+
     return parser.parse_args()
 
 def outp(args):
@@ -39,7 +36,7 @@ def main(args):
         s3bin = pub_bin
 
     fpath = s3path + out
-    if not path.exists(fpath):
+    if args.mkdir and not path.exists(fpath):
         makedirs(Path(fpath).parent)
 
     copyfile(inp, fpath)