[node-patches] Change in ovirt-node[master]: node-config: Show default values

fabiand at redhat.com fabiand at redhat.com
Tue Aug 12 13:53:11 UTC 2014


Fabian Deutsch has uploaded a new change for review.

Change subject: node-config: Show default values
......................................................................

node-config: Show default values

The help output now includes eventual default values for optional
arguments.

Change-Id: Ife0d532fd4cce293f5bea1cabc5d8b41f25a1492
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M scripts/ovirt-node-config
1 file changed, 11 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/07/31407/1

diff --git a/scripts/ovirt-node-config b/scripts/ovirt-node-config
index 7ff70e2..010601d 100755
--- a/scripts/ovirt-node-config
+++ b/scripts/ovirt-node-config
@@ -15,8 +15,17 @@
     return funcs
 
 def print_func_usage(func, with_doc=True):
-    args = inspect.getargspec(func).args[1:]
-    txtargs = " ".join("<%s>" % s.upper() for s in args)
+    argspec = inspect.getargspec(func)
+    args = argspec.args[1:]
+    txtargs = []
+    for idx, arg in enumerate(args):
+        defidx = idx - len(argspec.defaults) if argspec.defaults else -1
+        if defidx >= 0:
+            txtargs.append("[<%s=%s>]" % (arg.upper(),
+                                          argspec.defaults[defidx]))
+        else:
+            txtargs.append("<%s>" % arg.upper())
+    txtargs = " ".join(txtargs)
     if with_doc and inspect.getdoc(func):
         txtargs += "\n" + inspect.getdoc(func)
     return txtargs


-- 
To view, visit http://gerrit.ovirt.org/31407
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ife0d532fd4cce293f5bea1cabc5d8b41f25a1492
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Fabian Deutsch <fabiand at redhat.com>



More information about the node-patches mailing list