mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-18 15:21:16 +02:00
38421: _baudrates: Fit better into the general completion framework
This should work better in concert with other helpers and builtins of the completion system by accepting arguments that would be handed to compadd.
This commit is contained in:
parent
795b285ce8
commit
6f3fbcc67a
2 changed files with 8 additions and 11 deletions
|
@ -11,6 +11,9 @@
|
||||||
Completion/Unix/Command/_screen: Use _baudrates helper instead of
|
Completion/Unix/Command/_screen: Use _baudrates helper instead of
|
||||||
_baudrate
|
_baudrate
|
||||||
|
|
||||||
|
* 38421: Completion/Unix/Type/_baudrates: _baudrates: Fit better
|
||||||
|
into the general completion framework
|
||||||
|
|
||||||
2016-05-06 Daniel Shahaf <d.s@daniel.shahaf.name>
|
2016-05-06 Daniel Shahaf <d.s@daniel.shahaf.name>
|
||||||
|
|
||||||
* 38401: Completion/Debian/Type/_deb_packages: New completion
|
* 38401: Completion/Debian/Type/_deb_packages: New completion
|
||||||
|
|
|
@ -15,10 +15,6 @@
|
||||||
# value in the complete list to generate an arbitrary
|
# value in the complete list to generate an arbitrary
|
||||||
# sub-set.
|
# sub-set.
|
||||||
#
|
#
|
||||||
# -t TAG Use TAG as the tag value in _wanted call.
|
|
||||||
#
|
|
||||||
# -d DESC Use DESC as the description value in _wanted call.
|
|
||||||
#
|
|
||||||
# The default complete list of available baud rates is also configurable via
|
# The default complete list of available baud rates is also configurable via
|
||||||
# the 'baud-rates' style:
|
# the 'baud-rates' style:
|
||||||
#
|
#
|
||||||
|
@ -31,11 +27,11 @@
|
||||||
# zstyle ':completion:*:*:screen:*' min-baud-rate 1200
|
# zstyle ':completion:*:*:screen:*' min-baud-rate 1200
|
||||||
# zstyle ':completion:*:*:screen:*' baud-rate-filter some_function_name
|
# zstyle ':completion:*:*:screen:*' baud-rate-filter some_function_name
|
||||||
|
|
||||||
|
local tmp
|
||||||
|
local -a expl rates
|
||||||
local -A opts
|
local -A opts
|
||||||
local expl tag desc tmp
|
|
||||||
local -a rates
|
|
||||||
|
|
||||||
zparseopts -E -A opts u: l: f: d: t:
|
zparseopts -E -A opts u: l: f:
|
||||||
|
|
||||||
# The following uses a generated list; first find out where the B* macros are
|
# The following uses a generated list; first find out where the B* macros are
|
||||||
# defined:
|
# defined:
|
||||||
|
@ -76,9 +72,7 @@ if (( ${+opts[-f]} )); then
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
tag=${opts[-t]:-baud-rate}
|
|
||||||
desc=${opts[-d]:-baud rate}
|
|
||||||
|
|
||||||
# -1V removes dupes (which there shouldn't be) and otherwise leaves the
|
# -1V removes dupes (which there shouldn't be) and otherwise leaves the
|
||||||
# order in the $rates array intact.
|
# order in the $rates array intact.
|
||||||
_wanted -1V $tag expl $desc compadd -a $expl -- rates
|
_description -1V baud-rates expl 'baud rate'
|
||||||
|
compadd "${(@)argv/#-J/-V}" "$expl[@]" -- "${rates[@]}"
|
||||||
|
|
Loading…
Reference in a new issue