scripts: west_commands: completion: bash: Add support for west sdk

Add a feature for completion of the `west sdk` command.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
This commit is contained in:
TOKITA Hiroshi 2024-08-10 15:42:52 +09:00 committed by Anas Nashif
commit af5850d44a

View file

@ -1142,6 +1142,53 @@ __comp_west_twister()
esac
}
__comp_west_sdk()
{
local bool_opts="
--interactive -i
--no-toolchains -T
--no-hosttools -H
"
local dir_opts="
--install-dir -d
--install-base -b
"
local other_opts="
--version
--toolchains -t
--personal-access-token
--api-url
"
all_opts="$bool_opts $dir_opts $other_opts"
case "$prev" in
sdk)
__set_comp "list install"
return
;;
list)
return
;;
$(__west_to_extglob "$dir_opts") )
__set_comp_dirs
return
;;
# We don't know how to autocomplete those
$(__west_to_extglob "$other_opts") )
return
;;
esac
case "$cur" in
-*)
__set_comp $all_opts
;;
esac
}
__comp_west()
{
local previous_extglob_setting=$(shopt -p extglob)
@ -1176,6 +1223,7 @@ __comp_west()
spdx
blobs
twister
sdk
)
local cmds=(${builtin_cmds[*]} ${zephyr_ext_cmds[*]})