From 098319df9922441ca70c233195151cb1965556a8 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Sat, 31 Oct 2015 19:10:27 +0100 Subject: 37028: new scl completion --- Completion/Redhat/Command/_scl | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Completion/Redhat/Command/_scl (limited to 'Completion') diff --git a/Completion/Redhat/Command/_scl b/Completion/Redhat/Command/_scl new file mode 100644 index 000000000..e1a4b69db --- /dev/null +++ b/Completion/Redhat/Command/_scl @@ -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 -- cgit 1.4.1