[HOME] [DOWNLOAD] [DOCS] [NEWS] [SUPPORT] [TIPS] [ISSUES] [CONTRIBUTE] [DONATE]

bash-completion

please add full help messages when the command --help is called on whonix/anon commands.

add this to /usr/share/bash-completion/completions/qvm-check

# qvm-check(1)                                             -*- shell-script -*-

_qvm_check()
{
    local cur prev words cword
    _init_completion -s || return

    if [[ $cur == -* ]]; then
        COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur"))
    else
        COMPREPLY=($(IFS=$'\n' compgen -W '$(qvm-ls --raw-list)' -- "$cur"))
    fi  

} &&
    complete -F _qvm_check qvm-check

You have to install the bash-completion package:
sudo qubes-dom0-update bash-completion

then source with:
source /usr/share/bash-completion/bash_completion

Try qvm-check <TAB><TAB>
it will show vm-names

Try qvm-check --<TAB><TAB>
It will show options

This is the most basic script for this utility, other ones can be done with argument as seen on https://github.com/scop/bash-completion/
read completions/apt-get for example. wget, curl completions are also very good guides in my opinion.

Other examples can be found on onionjuggler/usr/share/bash-completion/completions at main · nyxnor/onionjuggler · GitHub

1 Like
[Imprint] [Privacy Policy] [Cookie Policy] [Terms of Use] [E-Sign Consent] [DMCA] [Contributors] [Investors] [Priority Support] [Professional Support]