diff options
author | Idan Horowitz <idan.horowitz@gmail.com> | 2021-12-28 20:10:22 +0200 |
---|---|---|
committer | Idan Horowitz <idan.horowitz@gmail.com> | 2021-12-28 22:03:33 +0200 |
commit | 11599a334232d203c21a21662375ac952e3d7f0a (patch) | |
tree | 44b131775f0dd39ff643d086ff5d41b1e83d5e44 | |
parent | 987b5adf2a703edafea6af210fd33f97ce5ddcc8 (diff) | |
download | serenity-11599a334232d203c21a21662375ac952e3d7f0a.zip |
pls: Stop on first non option when parsing arguments
This allows using pls on a program with arguments more ergonomically,
e.g. `pls -- echo "hello friends"` can now simply be done as:
`pls echo "hello friends"`.
-rw-r--r-- | Userland/Utilities/pls.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/Userland/Utilities/pls.cpp b/Userland/Utilities/pls.cpp index e66758e072..0b6c231b14 100644 --- a/Userland/Utilities/pls.cpp +++ b/Userland/Utilities/pls.cpp @@ -18,6 +18,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) Vector<char const*> command; Core::ArgsParser args_parser; uid_t as_user_uid = 0; + args_parser.set_stop_on_first_non_option(true); args_parser.add_option(as_user_uid, "User to execute as", nullptr, 'u', "UID"); args_parser.add_positional_argument(command, "Command to run at elevated privilege level", "command"); args_parser.parse(arguments); |