some infrastructure for 'roku lt' subcommand

This commit is contained in:
2023-06-08 19:13:38 +01:00
parent 950656d25d
commit eb085da965
7 changed files with 399 additions and 123 deletions

71
_roku_completion.sh Normal file
View File

@@ -0,0 +1,71 @@
#!/bin/sh
#
# It is assumed that the following variables are set.
#
#_ROKU_SHELL_DIR=$(dirname $(realpath $(readlink $0)))
#_ROKU_SHELL=$_ROKU_SHELL_DIR/_roku.sh
###############################################################################
#
# Build Completion
#
__roku_completion_contains()
{
# Platforms
for WORD in "$@"; do
if [[ "${COMP_WORDS[*]}" =~ "$WORD" ]]; then
return 1
fi
done
return 0
}
__roku_completion_add_if()
{
__roku_completion_contains "$@"
if [[ $? == 0 ]]; then
CANDIDATES+=" $@"
fi
}
# complete -F __build_completion roku
# __build_completion()
# {
# local CANDIDATES="help clobber tests addon-checksums"
# # Docker
# __build_completion_add_if docker make
# # Build hosts
# __build_completion_add_if icecc local
# # Port dir
# __build_completion_add_if port-only
# # Platforms
# __build_completion_add_if native marlin bailey loggan lockhart porting-kit streambar stb
# COMPREPLY=($(compgen -W "$CANDIDATES" "${COMP_WORDS[${COMP_CWORD}]}"))
# }
complete -F __roku_completion roku
__roku_completion()
{
local CANDIDATES="device get log flash gdb gdb_attach telnet reboot audcap san_update sideload token_install"
# # Docker
# __build_completion_add_if docker make
# # Build hosts
# __build_completion_add_if icecc local
# # Port dir
# __build_completion_add_if port-only
# # Platforms
# __build_completion_add_if native marlin bailey loggan lockhart porting-kit streambar stb
COMPREPLY=($(compgen -W "$CANDIDATES" "${COMP_WORDS[${COMP_CWORD}]}"))
}