summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--python/vyos/opmode.py11
-rwxr-xr-xsrc/op_mode/version.py2
2 files changed, 7 insertions, 6 deletions
diff --git a/python/vyos/opmode.py b/python/vyos/opmode.py
index 4e68d6e03..906bd0dcb 100644
--- a/python/vyos/opmode.py
+++ b/python/vyos/opmode.py
@@ -62,7 +62,7 @@ def _get_arg_type(t):
Doesn't work with anything else at the moment!
"""
if _is_optional_type(t):
- t.__args__[0]
+ return t.__args__[0]
else:
return t
@@ -81,12 +81,13 @@ def run(module):
for opt in type_hints:
th = type_hints[opt]
- if _is_optional_type(th):
- subparser.add_argument(f"--{opt}", type=_get_arg_type(th), default=None)
- elif _get_arg_type(th) == bool:
+ if _get_arg_type(th) == bool:
subparser.add_argument(f"--{opt}", action='store_true')
else:
- subparser.add_argument(f"--{opt}", type=_get_arg_type(th), required=True)
+ if _is_optional_type(th):
+ subparser.add_argument(f"--{opt}", type=_get_arg_type(th), default=None)
+ else:
+ subparser.add_argument(f"--{opt}", type=_get_arg_type(th), required=True)
# Get options as a dict rather than a namespace,
# so that we can modify it and pack for passing to functions
diff --git a/src/op_mode/version.py b/src/op_mode/version.py
index 90645dfbc..847bb197e 100755
--- a/src/op_mode/version.py
+++ b/src/op_mode/version.py
@@ -65,7 +65,7 @@ def _get_formatted_output(version_data):
tmpl = Template(version_output_tmpl)
return tmpl.render(version_data).strip()
-def show(raw: bool, funny: bool):
+def show(raw: bool, funny: typing.Optional[bool]):
""" Display neighbor table contents """
version_data = _get_raw_data(funny=funny)