From 8008f6268f4da575bd5f7e8aa35e3ce838f32baa Mon Sep 17 00:00:00 2001 From: Michael Becker Date: Tue, 19 Nov 2024 22:55:20 -0500 Subject: [PATCH] add mocha-suv bash completion script; install to /etc/bash_completion.d/ --- .../bash/etc/bash_completion.d/mocha-suv | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 mocha-suv/desktop-integration/bash/etc/bash_completion.d/mocha-suv diff --git a/mocha-suv/desktop-integration/bash/etc/bash_completion.d/mocha-suv b/mocha-suv/desktop-integration/bash/etc/bash_completion.d/mocha-suv new file mode 100644 index 0000000..7d73b05 --- /dev/null +++ b/mocha-suv/desktop-integration/bash/etc/bash_completion.d/mocha-suv @@ -0,0 +1,41 @@ +# Mocha command line completion -*- shell-script -*- + +_mocha() +{ + local cur=${COMP_WORDS[COMP_CWORD]} + _init_completion || return + + for (( i=1; i < ${#words[@]}; i++ )); do + if [[ " ${COMMANDS[*]} " == *" ${words[i]} "* ]]; then + command=${words[i]} + break + fi + done + + #COMPREPLY=() + if [[ $cur == -* || ( -v command && $COMP_CWORD -le $i ) ]]; then + case $prev in + mocha) + COMPREPLY=( $( compgen -W "oms suv" -- "$cur" ) ) + return 0 + ;; + suv) + COMPREPLY=( $( compgen -W "new up down delete shell status list" -- "$cur" ) ) + return 0 + ;; + up|down|delete|shell|status) + COMPREPLY=( $( compgen -W "$(ls /home/beckermj/Documents/Vagrant/mocha/machines)" -- "$cur" ) ) + return 0 + ;; + esac + return + fi + + #COMPREPLY=( $( compgen -W "oms suv" -- "$cur" ) ) + return 0 +} && + +complete -F _mocha mocha + +# ex: ts=4 sw=4 et filetype=sh +