chiark / gitweb /
bash-completion: fix completion of complete verbs
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 6 Feb 2014 05:31:22 +0000 (00:31 -0500)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 6 Feb 2014 05:45:00 +0000 (00:45 -0500)
When doing 'command verb<TAB>', the arguments for verb would be
proposed, but it is too early. We should complete verb first.

https://bugs.freedesktop.org/show_bug.cgi?id=74596

shell-completion/bash/busctl
shell-completion/bash/hostnamectl
shell-completion/bash/localectl
shell-completion/bash/loginctl
shell-completion/bash/systemctl
shell-completion/bash/systemd-analyze
shell-completion/bash/timedatectl
shell-completion/bash/udevadm

index 8ce813f4b3d26d92de4874c3bb4d64f81cacb48a..7480a6c3fb863b807d802fe5bf8c104c61dfc1eb 100644 (file)
@@ -53,7 +53,7 @@ _busctl() {
                 [STANDALONE]='list monitor'
         )
 
-        for ((i=0; i <= COMP_CWORD; i++)); do
+        for ((i=0; i < COMP_CWORD; i++)); do
                 if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]} &&
                  ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then
                         verb=${COMP_WORDS[i]}
index 38ab1344f3f31ee67faaed3cf7293623bc3168e5..9c75da9e7f8b6f699f0d465d1563e9e10e514650 100644 (file)
@@ -41,7 +41,7 @@ _hostnamectl() {
                       [NAME]='set-hostname'
         )
 
-        for ((i=0; i <= COMP_CWORD; i++)); do
+        for ((i=0; i < COMP_CWORD; i++)); do
                 if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]}; then
                         verb=${COMP_WORDS[i]}
                         break
index bec9e78c64b1a531a6303f2a0ec566dfe0205107..84e2a6b09e83174e151d1fa7b2349baad327db24 100644 (file)
@@ -52,7 +52,7 @@ _localectl() {
                       [X11]='set-x11-keymap'
         )
 
-        for ((i=0; i <= COMP_CWORD; i++)); do
+        for ((i=0; i < COMP_CWORD; i++)); do
                 if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]}; then
                         verb=${COMP_WORDS[i]}
                         break
index 7263f7f7bf71658d771dd9c4c60ecc5b132bc764..e7adb93f97b03599692f6ebc9fea2caa73b4a2fb 100644 (file)
@@ -70,7 +70,7 @@ _loginctl () {
                 [ATTACH]='attach'
         )
 
-        for ((i=0; i <= COMP_CWORD; i++)); do
+        for ((i=0; i < COMP_CWORD; i++)); do
                 if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]} &&
                  ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then
                         verb=${COMP_WORDS[i]}
index 232d2d65f4ca3d9976b462ebd0f40214058215fa..dc7ef6689820054018d28c0e3159584bb09f3547 100644 (file)
@@ -146,7 +146,7 @@ _systemctl () {
                   [TARGETS]='set-default'
         )
 
-        for ((i=0; i <= COMP_CWORD; i++)); do
+        for ((i=0; i < COMP_CWORD; i++)); do
                 if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]} &&
                  ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then
                         verb=${COMP_WORDS[i]}
index 98c793be9935d90bcc468e2567fb3939f643614f..6afcd963c33f3cc9598410df8b8c1445a4e646f1 100644 (file)
@@ -39,7 +39,7 @@ _systemd_analyze() {
 
         _init_completion || return
 
-        for ((i=0; i <= COMP_CWORD; i++)); do
+        for ((i=0; i < COMP_CWORD; i++)); do
                 if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]} &&
                  ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then
                         verb=${COMP_WORDS[i]}
index c6a6545257215201cf0f75cd0a0fe5eb888c6809..1a0acc6c7c089793d59d8de4d895cb51c47bc0c7 100644 (file)
@@ -52,7 +52,7 @@ _timedatectl() {
                      [TIME]='set-time'
         )
 
-        for ((i=0; i <= COMP_CWORD; i++)); do
+        for ((i=0; i < COMP_CWORD; i++)); do
                 if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]}; then
                         verb=${COMP_WORDS[i]}
                         break
index d58cdf532dc57a2c848fae36f950b2e1f188a027..b828b8dd7c1df1057ad5474c13b885482abb601d 100644 (file)
@@ -36,7 +36,7 @@ _udevadm() {
 
         local verbs=(info trigger settle control monitor hwdb test-builtin test)
 
-        for ((i=0; i <= COMP_CWORD; i++)); do
+        for ((i=0; i < COMP_CWORD; i++)); do
                 if __contains_word "${COMP_WORDS[i]}" "${verbs[@]}" &&
                  ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then
                         verb=${COMP_WORDS[i]}