Commits

Jan Borsodi committed 1d09da4

Removed dictionary usage in options and positional args, more thought and design (and testing) is needed before this is added.

  • Participants
  • Parent commits ec9c400
  • Branches fixes

Comments (0)

Files changed (1)

     def options(opts):
         args = []
         for opt in opts:
-            if isinstance(opt, dict):
-                name = opt["name"]
-                default = opt.get("default", None)
-                short = opt.get("short", "")
-                doc = opt.get("doc", "")
-                action = opt.get("action", None)
-            else:
-                short, name, default, doc = opt[0:4]
-                action = None
-                if len(opt) > 4:
-                    action = opt[4]
+            short, name, default, doc = opt[0:4]
+            action = None
+            if len(opt) > 4:
+                action = opt[4]
             names = []
             if short:
                 names.append("-" + short)
     def args(posargs):
         args = []
         for posarg in posargs:
-            if isinstance(posarg, dict):
-                singular = posarg["singular"]
-                default = posarg["default"]
-                plural = posarg.get("plural", None)
-                doc = posarg.get("doc", '')
-                action = posarg.get("action", None)
+            singular, default, doc = posarg[0:4]
+            if isinstance(singular, (list, tuple)):
+                singular, plural = singular
             else:
-                singular, default, doc = posarg[0:4]
-                if isinstance(singular, (list, tuple)):
-                    singular, plural = singular
-                else:
-                    plural = singular
-                action = None
-                if len(posarg) > 4:
-                    action = posarg[4]
+                plural = singular
+            action = None
+            if len(posarg) > 4:
+                action = posarg[4]
             arg = {"names": [plural],
                    "metavar": singular.lower()}
             if doc: