Browse Source

Merge pull request #11908 from mhilbrunner/docstatus-flagerror

doc_status.py: Error message for unknown CLI flag, shebang change

[ci skip]
Rémi Verschelde 8 years ago
parent
commit
cbeeba9c03
1 changed files with 16 additions and 12 deletions
  1. 16 12
      doc/tools/doc_status.py

+ 16 - 12
doc/tools/doc_status.py

@@ -1,4 +1,4 @@
-#!/usr/bin/env python3
+#!/usr/bin/env python
 
 import fnmatch
 import os
@@ -297,17 +297,21 @@ input_class_list = []
 merged_file = ""
 
 for arg in sys.argv[1:]:
-    if arg.startswith('--'):
-        flags[long_flags[arg[2:]]] = not flags[long_flags[arg[2:]]]
-    elif arg.startswith('-'):
-        for f in arg[1:]:
-            flags[f] = not flags[f]
-    elif os.path.isdir(arg):
-        for f in os.listdir(arg):
-            if f.endswith('.xml'):
-                input_file_list.append(os.path.join(arg, f));
-    else:
-        input_class_list.append(arg)
+    try:
+        if arg.startswith('--'):
+            flags[long_flags[arg[2:]]] = not flags[long_flags[arg[2:]]]
+        elif arg.startswith('-'):
+            for f in arg[1:]:
+                flags[f] = not flags[f]
+        elif os.path.isdir(arg):
+            for f in os.listdir(arg):
+                if f.endswith('.xml'):
+                    input_file_list.append(os.path.join(arg, f));
+        else:
+            input_class_list.append(arg)
+    except KeyError:
+        print("Unknown command line flag: " + arg)
+        sys.exit(1)
 
 if flags['i']:
     for r in ['methods', 'constants', 'members', 'signals']: