Append = to long options requiring an argument
Make it obvious that the option expects an argument by appending the equal sign on completion. Suspend space in this case. The regular expression in `output-options.sh` is adjusted to take into account this on processing option strings.
This commit is contained in:
parent
09132ace80
commit
8feb9053ec
File diff suppressed because it is too large
Load Diff
@ -52,6 +52,11 @@ _hledger_completion_function() {
|
||||
# Replace dashes with underscores and use indirect expansion
|
||||
subcommandOptions=_hledger_complist_options_${subcommand//-/_}
|
||||
_hledger_compreply "$(_hledger_compgen "${!subcommandOptions}")"
|
||||
|
||||
# Suspend space on completion of long options requiring an argument
|
||||
[[ ${COMPREPLY[0]} == --*= ]] && compopt -o nospace
|
||||
compopt +o filenames
|
||||
|
||||
return 0
|
||||
fi
|
||||
break
|
||||
@ -64,6 +69,9 @@ _hledger_completion_function() {
|
||||
compopt +o filenames
|
||||
if [[ $cur == -* ]]; then
|
||||
_hledger_compreply "$(_hledger_compgen "$_hledger_complist_generic_options")"
|
||||
|
||||
# Suspend space on completion of long options requiring an argument
|
||||
[[ ${COMPREPLY[0]} == --*= ]] && compopt -o nospace
|
||||
else
|
||||
_hledger_compreply "$(_hledger_compgen "$_hledger_complist_commands")"
|
||||
fi
|
||||
|
||||
@ -17,7 +17,7 @@ main() {
|
||||
|
||||
# Do not print '=' after long options with arg because it makes completion
|
||||
# for option arguments harder.
|
||||
sed -rn 's/.* (--[a-zA-Z][-_a-zA-Z0-9]*)=?.*/\1/gp' < "$tmp"
|
||||
sed -rn 's/.* (--[a-zA-Z][-_a-zA-Z0-9]*=?).*/\1/gp' < "$tmp"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user