mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-15 04:23:21 +00:00
Add bash-completion for BIOS settings
This commit is contained in:
parent
2536bf462c
commit
088397618a
@ -63,6 +63,27 @@ _fwupdmgr_opts=(
|
||||
'--json'
|
||||
)
|
||||
|
||||
bios_get_opts=(
|
||||
'--no-authenticate'
|
||||
'--json'
|
||||
'--verbose'
|
||||
)
|
||||
|
||||
bios_set_opts=(
|
||||
'--no-reboot-check'
|
||||
'--verbose'
|
||||
)
|
||||
|
||||
_show_bios_get_modifiers()
|
||||
{
|
||||
COMPREPLY+=( $(compgen -W '${bios_get_opts[@]}' -- "$cur") )
|
||||
}
|
||||
|
||||
_show_bios_set_modifiers()
|
||||
{
|
||||
COMPREPLY+=( $(compgen -W '${bios_set_opts[@]}' -- "$cur") )
|
||||
}
|
||||
|
||||
_show_filters()
|
||||
{
|
||||
local flags
|
||||
@ -75,6 +96,26 @@ _show_modifiers()
|
||||
COMPREPLY+=( $(compgen -W '${_fwupdmgr_opts[@]}' -- "$cur") )
|
||||
}
|
||||
|
||||
_show_bios_attrs()
|
||||
{
|
||||
if ! command -v jq &> /dev/null; then
|
||||
return 0
|
||||
fi
|
||||
local attr
|
||||
attr="$(command fwupdmgr get-bios-setting --json --no-authenticate 2>/dev/null | jq '.BiosAttributes | .[] | .Name')"
|
||||
COMPREPLY+=( $(compgen -W "${attr}" -- "$cur") )
|
||||
}
|
||||
|
||||
_show_bios_attrs_possible()
|
||||
{
|
||||
if ! command -v jq &> /dev/null; then
|
||||
return 0
|
||||
fi
|
||||
local attr
|
||||
attr="$(command fwupdmgr get-bios-setting "$1" --json --no-authenticate 2>/dev/null | jq '.BiosAttributes | .[] | .BiosAttrPossibleValues | .[]')"
|
||||
COMPREPLY+=( $(compgen -W "${attr}" -- "$cur") )
|
||||
}
|
||||
|
||||
_show_device_ids()
|
||||
{
|
||||
if ! command -v jq &> /dev/null; then
|
||||
@ -124,6 +165,25 @@ _fwupdmgr()
|
||||
_show_device_ids
|
||||
fi
|
||||
;;
|
||||
get-bios-settings|get-bios-setting)
|
||||
#bios attrs (no limit)
|
||||
_show_bios_attrs
|
||||
_show_bios_get_modifiers
|
||||
return 0
|
||||
;;
|
||||
set-bios-setting)
|
||||
#allow setting a single bios attr at a time
|
||||
if [[ "$args" = "2" ]]; then
|
||||
_show_bios_attrs
|
||||
fi
|
||||
#possible values (only works for enumeration though)
|
||||
if [[ "$args" = "3" ]]; then
|
||||
_show_bios_attrs_possible "$prev"
|
||||
return 0
|
||||
fi
|
||||
_show_bios_set_modifiers
|
||||
return 0
|
||||
;;
|
||||
get-details)
|
||||
#find files
|
||||
if [[ "$args" = "2" ]]; then
|
||||
|
Loading…
Reference in New Issue
Block a user