zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: Zsh workers <zsh-workers@zsh.org>
Subject: PATCH: completion for software collections on Redhat
Date: Sat, 31 Oct 2015 01:46:04 +0100	[thread overview]
Message-ID: <22712.1446252364@thecus.kiddle.eu> (raw)

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


                 reply	other threads:[~2015-10-31  0:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=22712.1446252364@thecus.kiddle.eu \
    --to=okiddle@yahoo.co.uk \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).