aboutsummaryrefslogtreecommitdiffstats
path: root/onap-client/onap_client/util.py
diff options
context:
space:
mode:
Diffstat (limited to 'onap-client/onap_client/util.py')
-rw-r--r--onap-client/onap_client/util.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/onap-client/onap_client/util.py b/onap-client/onap_client/util.py
index d3148d0..4c8043a 100644
--- a/onap-client/onap_client/util.py
+++ b/onap-client/onap_client/util.py
@@ -59,10 +59,6 @@ def utility_cli(onap_client, cli_arguments):
return
if callable(functions):
- if cli_arguments[0] == "--help":
- help(functions)
- return
-
if functions.__code__.co_argcount != len(cli_arguments):
print(
"Function requires {} arguments, but {} were passed. Try --help.".format(
@@ -71,6 +67,10 @@ def utility_cli(onap_client, cli_arguments):
)
return
+ if cli_arguments[0] == "--help":
+ help(functions)
+ return
+
return_data = functions(*cli_arguments[0:])
if isinstance(return_data, str):
print(return_data)
@@ -89,6 +89,12 @@ def convert_to_dash(argument):
def help(functions):
+ actions = get_actions(functions)
+
+ print(help_table(actions))
+
+
+def get_actions(functions):
actions = {}
actions["--help"] = ("", "")
if isinstance(functions, dict):
@@ -103,7 +109,7 @@ def help(functions):
list(functions.__code__.co_varnames[: functions.__code__.co_argcount]),
)
- print(help_table(actions))
+ return actions
def help_table(actions):