From 83f4397eb6983db5c090c7ea3200939f70022a6d Mon Sep 17 00:00:00 2001 From: Andrii Sultanov Date: Mon, 19 Aug 2024 12:42:58 +0100 Subject: [PATCH] IH-676: Add a Ctrl-r+q shortcut to insert names of required xe parameters ``` $ xe vdi-create $ xe vdi-create sr-uuid= name-label= virtual-size= ``` Signed-off-by: Andrii Sultanov --- ocaml/xe-cli/bash-completion | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ocaml/xe-cli/bash-completion b/ocaml/xe-cli/bash-completion index 099edfe88ff..0cf725eb76c 100644 --- a/ocaml/xe-cli/bash-completion +++ b/ocaml/xe-cli/bash-completion @@ -851,3 +851,16 @@ set_completions() } complete -F _xe -o nospace xe + +__autocomplete_reqd_params_names() +{ + local argv=( $READLINE_LINE ) + + local reqd_params=$(xe help "${argv[1]}" 2>/dev/null | grep '^[^:]*reqd params') + reqd_params=$(__process_params "$reqd_params") + echo "reqd params: ${reqd_params//,/ }" >> ce.debug + READLINE_LINE+="${reqd_params//,/ }" + return 0 +} + +bind -x '"\C-rq":"__autocomplete_reqd_params_names"'