mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-04-30 01:11:14 -03:00
src/builtin_argparse: Add --ignore-unknown flag
This keeps all unknown options in $argv, so ```fish argparse -i a/alpha -- -a banana -o val -w ``` results in $_flag_a set to banana, and $argv set to `-o val -w`. This allows users to use multiple argparse passes, or to simply avoid specifying all options e.g. in completions - `systemctl` has 46 of them, most not having any effect on the completions. Fixes #5367.
This commit is contained in:
@@ -33,6 +33,8 @@ The following ``argparse`` options are available. They must appear before all OP
|
||||
|
||||
- ``-X`` or ``--max-args`` is followed by an integer that defines the maximum number of acceptable non-option arguments. The default is infinity.
|
||||
|
||||
- ``-i`` or ``--ignore-unknown`` ignores unknown options, keeping them and their arguments in $argv instead.
|
||||
|
||||
- ``-s`` or ``--stop-nonopt`` causes scanning the arguments to stop as soon as the first non-option argument is seen. Using this arg is equivalent to calling the C function ``getopt_long()`` with the short options starting with a ``+`` symbol. This is sometimes known as "POSIXLY CORRECT". If this flag is not used then arguments are reordered (i.e., permuted) so that all non-option arguments are moved after option arguments. This mode has several uses but the main one is to implement a command that has subcommands.
|
||||
|
||||
- ``-h`` or ``--help`` displays help about using this command.
|
||||
|
||||
Reference in New Issue
Block a user