linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tomas Glozar <tglozar@redhat.com>
To: linux-rt-users@vger.kernel.org
Cc: jkacur@redhat.com, Tomas Glozar <tglozar@redhat.com>
Subject: [PATCH 1/2] rteval: Support custom argument default value help
Date: Wed, 16 Aug 2023 08:57:39 +0200	[thread overview]
Message-ID: <20230816065740.283407-2-tglozar@redhat.com> (raw)
In-Reply-To: <20230816065740.283407-1-tglozar@redhat.com>

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 --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


  reply	other threads:[~2023-08-16  6:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-16  6:57 [PATCH 0/2] rteval: Default to higher cyclictest bucket count on non-RT kernels Tomas Glozar
2023-08-16  6:57 ` Tomas Glozar [this message]
2023-08-16  6:57 ` [PATCH 2/2] rteval: Set " Tomas Glozar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230816065740.283407-2-tglozar@redhat.com \
    --to=tglozar@redhat.com \
    --cc=jkacur@redhat.com \
    --cc=linux-rt-users@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).