Skip to content

parse_switch() improvements #3555

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 5, 2025
Merged

Conversation

karelzak
Copy link
Collaborator

@karelzak karelzak commented May 5, 2025

No description provided.

Benno Schulenberg added 2 commits May 5, 2025 10:45
…ble'

Most other util-linux tools that accept the option argument "auto"
additionally accept "always" and "never", not "enable" / "disable".

So, make option --cpu-stat accept those standard words (besides the
deviant ones), and adjust the documentation to use the standard words.

Furthermore, make --cpu-stat accept also "on", "off", "yes", "no",
"1", and "0", to allow the user to use shorter words.  The per-CPU
stats can now be suppressed with a succinct: `irqtop -c0`.

CC: Zhenwei Pi <pizhenwei@bytedance.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
Calling gettext() is somewhat costly: it has to find the given message
among the more than five thousand messages in util-linux's repertoire.
So, call gettext() only when the message actually gets printed.

Besides, allowing to customize the error message for parse_switch() was
a nice gesture, but it's unneeded: a fixed error message is good enough.

Also, "argument error" was rather vague, as it doesn't say _what_ the
error is.  Better say "unsupported argument".

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
@karelzak karelzak added the PR-FROM-MAILING-LIST This pull request is based on a patch from the mailing list. label May 5, 2025
Signed-off-by: Karel Zak <kzak@redhat.com>
@karelzak karelzak merged commit 91dbf35 into util-linux:master May 5, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR-FROM-MAILING-LIST This pull request is based on a patch from the mailing list.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant