Added "scoop bucket" Bash completion.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Sun, 29 Oct 2023 13:24:48 +0200
changeset 1019 ee5840caf22c
parent 1018 831e2c1bf980
child 1020 ee4b6963627e
Added "scoop bucket" Bash completion.
.bash_completion.d/scoop
--- a/.bash_completion.d/scoop	Wed Mar 29 23:42:06 2023 +0300
+++ b/.bash_completion.d/scoop	Sun Oct 29 13:24:48 2023 +0200
@@ -58,6 +58,25 @@
       cd "$olddir"
       return
     ;;
+    bucket)
+      if [[ $COMP_CWORD = 2 ]]; then
+        COMPREPLY=( $(compgen -W 'add list known rm' -- "$cur") )
+        return
+      fi
+      local subcmd="${COMP_WORDS[2]}"
+      case "$subcmd" in
+        list|known)
+          COMPREPLY=( )
+          return
+          ;;
+        add|rm)
+          local -a buckets=( `scoop bucket known` )
+          local cr=$'\r'
+          buckets=( "${buckets[@]/$cr/}" )
+          COMPREPLY=( $(compgen -W '${buckets[@]}' -- "$cur") )
+          return
+          ;;
+      esac
   esac
 }