From: Brian Norris <briannorris@chromium.org>
To: Douglas Anderson <dianders@chromium.org>
Cc: sjg@chromium.org, amstan@chromium.org, mka@chromium.org,
u-boot@lists.denx.de
Subject: Re: [PATCH 4/6] patman: Make most bool arguments BooleanOptionalAction
Date: Thu, 30 Jun 2022 14:30:40 -0700 [thread overview]
Message-ID: <Yr4WAEbYq2M2W2OP@google.com> (raw)
In-Reply-To: <20220630140742.4.I6cb1a37e190dd759acc478beb2b0e0dc8e483923@changeid>
On Thu, Jun 30, 2022 at 02:08:07PM -0700, Doug Anderson wrote:
> For boolean arguments it's convenient to be able to specify both the
> argument and its opposite on the command line. This is especially
> convenient because you can change the default via the settings file
> and being able express the opposite can be the only way to override
> things.
>
> Luckily python handles this well--we just need to specify things with
> BooleanOptionalAction. We'll do that for all options except
> "full-help" (where it feels silly). This uglifies the help text a
> little bit but does give maximum flexibility.
>
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
> ---
>
> tools/patman/main.py | 52 +++++++++++++++++++++++---------------------
> 1 file changed, 27 insertions(+), 25 deletions(-)
>
> diff --git a/tools/patman/main.py b/tools/patman/main.py
> index 336f4e439aa9..9684300c022c 100755
> --- a/tools/patman/main.py
> +++ b/tools/patman/main.py
> -send.add_argument('-t', '--ignore-bad-tags', action='store_true',
> +send.add_argument('-t', '--ignore-bad-tags', action=BooleanOptionalAction,
> default=False,
> help='Ignore bad tags / aliases (default=warn)')
I know you mentioned --help ugliness, but this one ends up looking like:
(default=warn) (default: False)
Perhaps we should drop the baked-in "(default=warn)" text?
Otherwise:
Reviewed-by: Brian Norris <briannorris@chromium.org>
Tested-by: Brian Norris <briannorris@chromium.org>
next prev parent reply other threads:[~2022-06-30 21:30 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-30 21:08 [PATCH 0/6] patman: Small fixes plus remove --no-tree from checkpatch for linux Douglas Anderson
2022-06-30 21:08 ` [PATCH 1/6] patman: Fix updating argument defaults from settings Douglas Anderson
2022-06-30 21:08 ` [PATCH 2/6] patman: Fix implicit command inserting Douglas Anderson
2022-06-30 21:08 ` [PATCH 3/6] patman: Don't look at sys.argv when parsing settings Douglas Anderson
2022-06-30 21:08 ` [PATCH 4/6] patman: Make most bool arguments BooleanOptionalAction Douglas Anderson
2022-06-30 21:30 ` Brian Norris [this message]
2022-06-30 21:08 ` [PATCH 5/6] patman: By default don't pass "--no-tree" to checkpatch for linux Douglas Anderson
2022-06-30 21:08 ` [PATCH 6/6] patman: Take project defaults into account for --help Douglas Anderson
2022-06-30 22:15 ` Brian Norris
2022-06-30 22:18 ` [PATCH 0/6] patman: Small fixes plus remove --no-tree from checkpatch for linux Brian Norris
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=Yr4WAEbYq2M2W2OP@google.com \
--to=briannorris@chromium.org \
--cc=amstan@chromium.org \
--cc=dianders@chromium.org \
--cc=mka@chromium.org \
--cc=sjg@chromium.org \
--cc=u-boot@lists.denx.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.