[PATCH 1/2] rteval: Support custom argument default value help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add an optional default_value option to sets returned from
ModuleParameters to specify a different default value help text than
the value of default field.

This is useful for cases where the default value depends on
the environment

Signed-off-by: Tomas Glozar <tglozar@xxxxxxxxxx>
---
 rteval/modules/__init__.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/rteval/modules/__init__.py b/rteval/modules/__init__.py
index e7025ce..469d0f0 100644
--- a/rteval/modules/__init__.py
+++ b/rteval/modules/__init__.py
@@ -307,12 +307,13 @@ the information provided by the module"""
                 if default is None:
                     default = 'default' in s and s['default'] or None
 
+                default_text = s['default_text'] if 'default_text' in s else default
 
                 grparser.add_argument('--%s-%s' % (shortmod, o),
                                     dest="%s___%s" % (shortmod, o),
                                     action='store',
                                     help='%s%s' % (descr,
-                                                   default and ' (default: %s)' % default or ''),
+                                                   default and ' (default: %s)' % default_text or ''),
                                     default=default,
                                     metavar=metavar)
 
-- 
2.41.0




[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux