summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Kiddle <okiddle@yahoo.co.uk>2018-03-28 10:30:05 +0200
committerOliver Kiddle <okiddle@yahoo.co.uk>2018-03-28 10:30:05 +0200
commitc2c9a163509bd36d15239b21b9c553eeba23f986 (patch)
tree3e08d698061dc0f420b869a88ab25c4a42c13a22
parent9881778d48caf842f794d986bc9befebf0fb01c2 (diff)
downloadzsh-c2c9a163509bd36d15239b21b9c553eeba23f986.tar.gz
zsh-c2c9a163509bd36d15239b21b9c553eeba23f986.tar.xz
zsh-c2c9a163509bd36d15239b21b9c553eeba23f986.zip
42549: also handle the yumdb command in yum completion
-rw-r--r--ChangeLog3
-rw-r--r--Completion/Redhat/Command/_yum54
2 files changed, 56 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 50e26dce1..72fc778ce 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2018-03-28  Oliver Kiddle  <okiddle@yahoo.co.uk>
 
+	* 42549: Completion/Redhat/Command/_yum: also handle the yumdb
+	command in yum completion
+
 	* 42550: Completion/Unix/Command/_gem: completion for ruby's gem
 
 	* 42539: Src/utils.c: prevent overflow of PATH_MAX-sized
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