mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 18:02:05 -05:00
sysctl: Permit 'sysctl -a' invocation
The point of '-a' is to list all keys. It is counter-intuitive to require the user to then supply a specific key additionally.
This commit is contained in:
parent
e6547a7e95
commit
f09a8f8a6e
1 changed files with 7 additions and 1 deletions
|
@ -114,10 +114,16 @@ int main(int argc, char** argv)
|
|||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_option(show_all, "Show all variables", nullptr, 'a');
|
||||
args_parser.add_positional_argument(var, "Command (var[=value])", "command");
|
||||
args_parser.add_positional_argument(var, "Command (var[=value])", "command", Core::ArgsParser::Required::No);
|
||||
args_parser.parse(argc, argv);
|
||||
|
||||
if (var == nullptr) {
|
||||
// Not supplied; assume `-a`.
|
||||
show_all = true;
|
||||
}
|
||||
|
||||
if (show_all) {
|
||||
// Ignore `var`, even if it was supplied. Just like the real procps does.
|
||||
return handle_show_all();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue