You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the current implementation checks an option argument, it tests
whether the previous word matches $2 (i.e., a pattern of options
taking an option argument). This implementation has multiple issues:
* When the options taking an option argument does not start with `-`,
the option is counted as an independent argument. For example,
`ssh` completion passes `@(-c|[-+]o)` as $2, but `+o` is counted as
an argument with the current implementation.
* An option argument that looks like an option taking an option
argument can prevent the next word counted as an argument. For
example, when `cmd -o -o arg` is processed with $2 being `-o`, the
second `-o` should be treated as an option argument and `arg` should
be counted as an argument. However, with the current
implementation, `arg` is not counted because the previous word `-o`
matches the pattern.
* When `cmd -o -- -x` is processed with $2 being `-o`, `--` should be
treated as an option argument so should lose its special meaning,
and `-x` is still treated as an option. However, with the current
implementation, `--` does not lose its special meaning, so `-x` is
unexpectedly treated as an argument.
* Also, with the current implementation, when $2 is not specified, an
argument after an empty word is not counted as an argument because
$2 matches the empty word, (though Readline usually do not store an
empty word in COMP_WORDS).
This patch fixes those issues by changing how options taking an option
argument are processed.
0 commit comments