zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: Zsh workers <zsh-workers@zsh.org>
Subject: PATCH: also handle yumdb from yum completion
Date: Tue, 27 Mar 2018 23:39:50 +0200	[thread overview]
Message-ID: <7409.1522186790@thecus> (raw)

This updates the yum completion to also handle yumdb.

Oliver

diff --git a/Completion/Redhat/Command/_yum b/Completion/Redhat/Command/_yum
index 4698a3159..34a337109 100644
--- a/Completion/Redhat/Command/_yum
+++ b/Completion/Redhat/Command/_yum
@@ -1,9 +1,14 @@
-#compdef yum
+#compdef yum yumdb
 
 # Main dispatcher
 _yum() {
   local curcontext="$curcontext" state lstate line
 
+  if [[ $service = yumdb ]]; then
+    _yumdb
+    return
+  fi
+
   _arguments -s \
     '(- *)'{-h,--help}'[show the help message]' \
     '(-t --tolerant)'{-t,--tolerant}'[be tolerant of errors]' \
@@ -46,6 +51,53 @@ _yum() {
     '*::yum command:_yum_command'
 }
 
+_yumdb() {
+  local curcontext="$curcontext" desc ret=1
+  local -a state line
+
+  _arguments -C \
+    '(- 1)--version[display version information]' \
+    '(- 1)'{-h,--help}'[display help information]' \
+    '--noplugins[disable yum plugin support]' \
+    '(-c --config)'{-c,--config=}'[specify config file location]:Yum conf file:_files' \
+    '1:command:((
+      get\:get\ value\ of\ given\ key
+      set\:set\ value\ of\ given\ key
+      del\:delete\ given\ key
+      rename\:rename\ given\ key
+      rename-force\:rename\ given\ key,\ potentially\ removing\ new-key
+      copy\:copy\ given\ key
+      copy-force\:copy\ given\ key,\ potentially\ removing\ new-key
+      search\:search\ packages\ for\ given\ key
+      exist\:list\ packages\ that\ have\ given\ key
+      unset\:list\ packages\ that\ lack\ given\ key
+      info\:display\ data\ in\ the\ yumdb
+      sync\:add\ package\ data\ from\ repositories
+      sync-force\:replace\ package\ data\ from\ repositories
+      undeleted shell
+    ))' \
+    '*:: :->args' && ret=0
+
+  if [[ -n $state ]]; then
+    case $CURRENT:$words[1] in
+      3:set|<3->:search)
+        case $words[2] in
+          reason) _wanted reasons expl reason compadd user dep ;;
+          *) _message -e values value ;;
+        esac
+      ;;
+      3:(copy|rename)*) desc='new key';&
+      2:(^(info|sync)))
+        _wanted -x keys expl "${desc:-key}" compadd \
+          checksum_data checksum_type command_line from_repo from_repo_revision \
+          from_repo_timestamp reason releasever installonly origin_url changed_by && ret=0
+      ;;
+      *) _yum_act_on_installed_pkgs && ret=0 ;;
+    esac
+  fi
+  return ret
+}
+
 (( $+functions[_yum_command] )) || _yum_command()
 {
   local -a _yum_cmds


                 reply	other threads:[~2018-03-28  1:01 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=7409.1522186790@thecus \
    --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).