diff mbox series

[1/3] rteval: Allow arguments specific to module group

Message ID 20230810090123.151924-2-tglozar@redhat.com
State Superseded
Headers show
Series rteval: Add cmdline option to run measurements on isolcpus by default | expand

Commit Message

Tomas Glozar Aug. 10, 2023, 9:01 a.m. UTC
Return grparser from ModuleContainer.SetupModuleOptions, which allows it
to be used to setup additional options in *Modules class.

Signed-off-by: Tomas Glozar <tglozar@redhat.com>
---
 rteval/modules/__init__.py | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/rteval/modules/__init__.py b/rteval/modules/__init__.py
index 794135d..f4fd160 100644
--- a/rteval/modules/__init__.py
+++ b/rteval/modules/__init__.py
@@ -312,7 +312,7 @@  the information provided by the module"""
                 # Ignore if a section is not found
                 cfg = None
 
-            grparser = parser.add_argument_group("Options for the %s module" % shortmod)
+            modgrparser = parser.add_argument_group("Options for the %s module" % shortmod)
             for (o, s) in list(opts.items()):
                 descr = 'descr' in s and s['descr'] or ""
                 metavar = 'metavar' in s and s['metavar'] or None
@@ -327,13 +327,15 @@  the information provided by the module"""
                     default = 'default' in s and s['default'] or None
 
 
-                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=default,
-                                    metavar=metavar)
+                modgrparser.add_argument('--%s-%s' % (shortmod, o),
+                                         dest="%s___%s" % (shortmod, o),
+                                         action='store',
+                                         help='%s%s' % (descr,
+                                                        default and ' (default: %s)' % default or ''),
+                                         default=default,
+                                         metavar=metavar)
+
+            return grparser
 
 
     def InstantiateModule(self, modname, modcfg, modroot=None):