diff mbox series

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

Message ID 20230816065740.283407-2-tglozar@redhat.com
State New
Headers show
Series rteval: Default to higher cyclictest bucket count on non-RT kernels | expand

Commit Message

Tomas Glozar Aug. 16, 2023, 6:57 a.m. UTC
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@redhat.com>
---
 rteval/modules/__init__.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

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)