mirror of
https://github.com/Qubes-Community/Contents.git
synced 2024-12-22 13:55:08 -05:00
Merge pull request #13 from taradiddles/master
add bash autocompletion script
This commit is contained in:
commit
4608ea6ac4
52
code/productivity/qvm-cmds-bash-completion.sh
Normal file
52
code/productivity/qvm-cmds-bash-completion.sh
Normal file
@ -0,0 +1,52 @@
|
||||
# qvm-* commands bash auto completion
|
||||
|
||||
# copy this file to /etc/bash_completion.d/qvm.sh
|
||||
# make sure 'bash-completion' is installed (sudo qubes-dom0-update bash-completion)
|
||||
|
||||
# credit: https://www.mail-archive.com/qubes-users@googlegroups.com/msg20088.html
|
||||
|
||||
_qvm()
|
||||
{
|
||||
local cur vms
|
||||
local state=${1}
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
case ${state} in
|
||||
running|halted|paused)
|
||||
vms=$(qvm-ls --raw-data | grep -i "|${state}|" | cut -f1 -d"|")
|
||||
;;
|
||||
"")
|
||||
vms=$(qvm-ls --raw-list)
|
||||
;;
|
||||
*) vms=""
|
||||
esac
|
||||
COMPREPLY=( $(compgen -W "${vms}" ${cur}) )
|
||||
return 0
|
||||
}
|
||||
|
||||
_qvmall() { _qvm ""; }
|
||||
_qvmrunning() { _qvm "running"; }
|
||||
_qvmhalted() { _qvm "halted"; }
|
||||
_qvmpaused() { _qvm "paused"; }
|
||||
|
||||
complete -F _qvmall qvm-appmenus
|
||||
complete -F _qvmall qvm-backup
|
||||
complete -F _qvmall qvm-backup-restore
|
||||
complete -F _qvmall qvm-check
|
||||
complete -F _qvmall qvm-clone
|
||||
complete -F _qvmall qvm-copy-to-vm
|
||||
complete -F _qvmall qvm-features
|
||||
complete -F _qvmall qvm-firewall
|
||||
complete -F _qvmall qvm-move-to-vm
|
||||
complete -F _qvmall qvm-prefs
|
||||
complete -F _qvmall qvm-remove
|
||||
complete -F _qvmall qvm-run
|
||||
complete -F _qvmall qvm-service
|
||||
complete -F _qvmall qvm-start-gui
|
||||
complete -F _qvmall qvm-tags
|
||||
complete -F _qvmall qvm-usb
|
||||
complete -F _qvmhalted qvm-start
|
||||
complete -F _qvmpaused qvm-unpause
|
||||
complete -F _qvmrunning qvm-kill
|
||||
complete -F _qvmrunning qvm-pause
|
||||
complete -F _qvmrunning qvm-shutdown
|
Loading…
Reference in New Issue
Block a user