1. Łukasz Langa
  2. rename

Commits

Łukasz Langa  committed c7118e8

fixed: two-level argparse broke support for -h

  • Participants
  • Parent commits d27f3d6
  • Branches default
  • Tags 1.0c2

Comments (0)

Files changed (2)

File setup.py

View file
 
 setup (
     name = 'rename',
-    version = '1.0c1',
+    version = '1.0c2',
     author = 'Lukasz Langa',
     author_email = 'support@langacore.org, lukasz@langa.pl',
     description = "Renames files using regular expressions",

File src/rename.py

View file
                                                 'references to groups in the '
                                                 'regular expression')
 
-    stparser = argparse.ArgumentParser(prog='rename')
+    stparser = argparse.ArgumentParser(prog='rename', add_help=False)
     stparser.add_argument('--selftest', action='store_true',
                         help='run internal unit tests')
-    args = stparser.parse_args()
-    if not args.selftest:
+    args = stparser.parse_known_args()
+    if not args[0].selftest:
         args = parser.parse_args()
         args.regex = "".join(args.regex)
         args.except_regex = "".join(args.except_regex)