fwupd/data/bash-completion/fwupdtool
Richard Hughes c02ee4da46 Allow whitelisting plugins in fwupdtool
When developing code it's really convenient to only run the new plugin. This
means you don't have to wait for the other hardware to initialize and there
are no side-effects from other plugins when installing firmware.

You can specify multiple plugins as globs, for instance:

    fwupdtool get-devices \
        --plugin-whitelist wacom \
        --plugin-whitelist "thunderbolt*"
2018-05-22 16:03:14 -05:00

67 lines
995 B
Plaintext

_fwupdmgr_cmd_list=(
'get-devices'
'get-topology'
'install'
'install-blob'
'smbios-dump'
'attach'
'detach'
'watch'
)
_fwupdmgr_opts=(
'--verbose'
'--allow-reinstall'
'--allow-older'
'--force'
'--show-all-devices'
'--plugin-whitelist'
)
_show_modifiers()
{
COMPREPLY+=( $(compgen -W '${_fwupdmgr_opts[@]}' -- "$cur") )
}
_fwupdtool()
{
local cur prev command
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
command=${COMP_WORDS[1]}
case $command in
install|install-blob)
#find files
if [[ "$prev" = "$command" ]]; then
_filedir
#modifiers
else
_show_modifiers
fi
;;
attach|detach)
if [[ "$prev" = "$command" ]]; then
_show_device_ids
#modifiers
else
_show_modifiers
fi
;;
*)
#find first command
if [[ ${COMP_CWORD} = 1 ]]; then
COMPREPLY=( $(compgen -W '${_fwupdmgr_cmd_list[@]}' -- "$cur") )
#modifiers for all commands
else
_show_modifiers
fi
;;
esac
return 0
}
complete -F _fwupdtool fwupdtool