Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: completion for software collections on Redhat
- X-seq: zsh-workers 37028
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxx>
- Subject: PATCH: completion for software collections on Redhat
- Date: Sat, 31 Oct 2015 01:46:04 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1446252365; bh=XhxE0BD8xjRy1/iptwrsN/CPu2NyOej77Mtn2SA8RQM=; h=From:To:Subject:Date:From:Subject; b=OoWp8TT5j8hUkUvYc9bHZbiHkyd5B+tj+7ITGSSTCheSk/SyfNkxIKjJksQV/fC2MfH9Z9ILO8rcHH4b/kUoUuDjLBMSgSohr8O3ynGh9nKqrAkGqFaPowVkxSXUr1/+7irfbeXmfpcLuy3A9xwhZJYSKi4dSHAblzOxn/m1H7dP9HlTjvEOJ8GkbMfF5veYrN9xu9WQYN9mJq+MqbyB+y3mtYnTPmBgfhSCi10hQ3evGdLEn7N0Y3jKFw5hOupTDdVls2QnKgtta5EGTDZpQz7+RlniVWPx4irp7hgVdtKdhm4PfTi1RShJ9+FdrUCh3Uqf+cjuBMUKlP9dQdfvCA==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
scl is a Redhat thing for using newer versions of stuff like gcc and
maven than the those the system comes with.
Oliver
diff --git a/Completion/Redhat/Command/_scl b/Completion/Redhat/Command/_scl
new file mode 100644
index 0000000..4b9c53b
--- /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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author