mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-01-25 01:21:09 +01:00
37028: new scl completion
This commit is contained in:
parent
607a7a85b6
commit
098319df99
2 changed files with 40 additions and 0 deletions
|
@ -1,5 +1,7 @@
|
|||
2015-10-31 Oliver Kiddle <opk@zsh.org>
|
||||
|
||||
* 37028: Completion/Redhat/Command/_scl: new completion
|
||||
|
||||
* 36993: Eric Cook: Functions/Misc/zed: fix argument parsing
|
||||
|
||||
2015-10-31 Barton E. Schaefer <schaefer@zsh.org>
|
||||
|
|
38
Completion/Redhat/Command/_scl
Normal file
38
Completion/Redhat/Command/_scl
Normal file
|
@ -0,0 +1,38 @@
|
|||
#compdef scl
|
||||
|
||||
local curcontext="$curcontext" dashes ret=1
|
||||
local -a state line force alts cmd
|
||||
|
||||
[[ $words[2] = deregister ]] &&
|
||||
force=( '--force[deregister even SCL installed as packages]' )
|
||||
|
||||
_arguments -C $force \
|
||||
'(- 1)'{-l,--list}'[list installed software collections or packages within a collection]' \
|
||||
'(-l --list)1:action:(enable register deregister)' \
|
||||
'(-)*:collections:->collections' && ret=0
|
||||
|
||||
if [[ -n $state ]]; then
|
||||
(( $#line > 1 )) && curcontext="${curcontext%:*}-$line[1]:"
|
||||
if [[ $line[1] = register ]]; then
|
||||
_directories -P / -W /
|
||||
return
|
||||
fi
|
||||
if (( ${dashes:=$words[(I)--]} )); then
|
||||
shift dashes words
|
||||
(( CURRENT -= dashes ))
|
||||
_normal
|
||||
return
|
||||
fi
|
||||
if [[ $CURRENT -gt 3 && $words[CURRENT] = - ]]; then
|
||||
compadd - --
|
||||
return
|
||||
fi
|
||||
[[ $line[1] = enable && $CURRENT -gt 3 ]] &&
|
||||
cmd='command:command:_cmdstring'
|
||||
|
||||
_alternative 'collections:collection:compadd
|
||||
$(_call_program collections ${words[1]} -l)' \
|
||||
$cmd && ret=0
|
||||
fi
|
||||
|
||||
return ret
|
Loading…
Reference in a new issue