scripts/bash-completion: Extract all rpc methods
Currently we extract these methods from rpc.py's --help or from rpc_get_methods() in case there's a SPDK application running in the background. This, however, results in a list missing some basic methods that rpc_get_methods() simply doesn't include, e.g. save_subsystem_config(). To make sure we always have a complete list use both, --help and the rpc_get_methods() together. Signed-off-by: Michal Berger <michal.berger@intel.com> Change-Id: Ie73917b74860cac13056bea9babc7f7b57e39b3a Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14115 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com> Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
9c8c34ab0b
commit
49543bca68
@ -45,13 +45,11 @@ _get_default_rpc_methods() {
|
||||
done < <(_get_help "$1" 2> /dev/null)
|
||||
}
|
||||
|
||||
_get_supported_methods() {
|
||||
_get_rpc_methods() {
|
||||
local method methods
|
||||
|
||||
if ! methods=($("$1" -s "$rpc_sock" rpc_get_methods 2> /dev/null)); then
|
||||
_get_default_rpc_methods "$1"
|
||||
return 0
|
||||
fi
|
||||
methods=($("$1" -s "$rpc_sock" rpc_get_methods 2> /dev/null)) || return 0
|
||||
((${#methods[@]} > 0)) || return 0
|
||||
|
||||
# Kill the json flavor
|
||||
@ -207,11 +205,7 @@ _rpc() {
|
||||
local -A rpc_methods=()
|
||||
|
||||
_set_rpc_sock
|
||||
if [[ -S $rpc_sock ]]; then
|
||||
_get_supported_methods "$rpc"
|
||||
else
|
||||
_get_default_rpc_methods "$rpc"
|
||||
fi
|
||||
_get_rpc_methods "$rpc"
|
||||
|
||||
if method=$(_method_in_words); then
|
||||
COMPREPLY=($(compgen -W '$(_get_help_rpc_method "$rpc" "$method")' -- "$cur"))
|
||||
|
Loading…
Reference in New Issue
Block a user