diff options
author | Clint Adams <clint@users.sourceforge.net> | 2008-10-07 07:48:55 +0000 |
---|---|---|
committer | Clint Adams <clint@users.sourceforge.net> | 2008-10-07 07:48:55 +0000 |
commit | e6e5d2eb1db839df64aa5fafad188c62807aa82b (patch) | |
tree | 74e98954639e70caa25c1de8191dc29edd503c78 /Completion/Linux/Command | |
parent | 8538c98ddf96430815df970ab881987d6a436787 (diff) | |
download | zsh-e6e5d2eb1db839df64aa5fafad188c62807aa82b.tar.gz zsh-e6e5d2eb1db839df64aa5fafad188c62807aa82b.tar.xz zsh-e6e5d2eb1db839df64aa5fafad188c62807aa82b.zip |
Jörg Sommer: 25819: improve module parameter completion.
First, do not embedd the = in the parameter by define it a parameter‐value separator; -S =. Second, look for already given parameters in all words; -w. Third, use the curcontext variable; -C. Forth, distinct between boolean and non‐boolean parameters, i.e. do not append a = to the end. And include the type of the parameter in the help message. This information is only given in the full output of modinfo, not in the narrowed output with --field.
Diffstat (limited to 'Completion/Linux/Command')
-rw-r--r-- | Completion/Linux/Command/_modutils | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/Completion/Linux/Command/_modutils b/Completion/Linux/Command/_modutils index faab85275..eefb11f2a 100644 --- a/Completion/Linux/Command/_modutils +++ b/Completion/Linux/Command/_modutils @@ -95,10 +95,17 @@ case "$state" in if compset -P '*='; then _message -e value 'parameter value' else - typeset -A val_args + local params + params=( ${${(M)${(f)"$(_call_program module_parameter modinfo "$words[2]" 2>/dev/null)"}:#parm:*}##parm:[[:space:]]##} ) + if [[ $#params -eq 0 ]]; then + _message -e parameter "This modules doesn't have parameters" + else + typeset -A val_args - _values 'module parameter' \ - ${(f)^"$(_call_program module_parameter modinfo -F parm "$words[2]" 2>/dev/null)"//:/\=[}\] && ret=0 + _values -S = -C -w 'module parameter' \ + ${${${(M)params:#*(:bool|\(bool\))}/:/[}/(bool| \(bool\))/]} \ + ${^${params:#*(:bool|\(bool\))}/:/[}"]:auto added argument: " && ret=0 + fi fi ;; esac |