various updates v.dev3

This commit is contained in:
ge
2023-12-13 01:42:50 +03:00
parent b0fa1b7b25
commit d7a73e9bd1
49 changed files with 1872 additions and 904 deletions

View File

@ -1,13 +1,13 @@
# compute bash completion script
_compute_global_opts="--connect --log-level"
_compute_root_cmd="
$_compute_global_opts
--version
--verbose
--connect
--log-level
init
exec
ls
lsdisks
start
shutdown
reboot
@ -20,23 +20,34 @@ _compute_root_cmd="
setmem
setpass
setcdrom
setcloudinit
delete"
_compute_init_opts="--test --start"
_compute_exec_opts="--timeout --executable --env --no-join-args"
_compute_ls_opts=""
_compute_start_opts=""
_compute_shutdown_opts="--soft --normal --hard --unsafe"
_compute_reboot_opts=""
_compute_reset_opts=""
_compute_powrst_opts=""
_compute_pause_opts=""
_compute_resume_opts=""
_compute_status_opts=""
_compute_setvcpus_opts=""
_compute_setmem_opts=""
_compute_setpass_opts="--encrypted"
_compute_setcdrom_opts="--detach"
_compute_delete_opts="--yes --save-volumes"
_compute_init_opts="$_compute_global_opts --test --start"
_compute_exec_opts="$_compute_global_opts
--timeout
--executable
--env
--no-join-args"
_compute_ls_opts="$_compute_global_opts"
_compute_lsdisks_opts="$_compute_global_opts --persistent"
_compute_start_opts="$_compute_global_opts"
_compute_shutdown_opts="$_compute_global_opts --soft --normal --hard --unsafe"
_compute_reboot_opts="$_compute_global_opts"
_compute_reset_opts="$_compute_global_opts"
_compute_powrst_opts="$_compute_global_opts"
_compute_pause_opts="$_compute_global_opts"
_compute_resume_opts="$_compute_global_opts"
_compute_status_opts="$_compute_global_opts"
_compute_setvcpus_opts="$_compute_global_opts"
_compute_setmem_opts="$_compute_global_opts"
_compute_setpass_opts="$_compute_global_opts --encrypted"
_compute_setcdrom_opts="$_compute_global_opts --detach"
_compute_setcloudinit_opts="$_compute_global_opts
--user-data
--vendor-data
--meta-data
--network-config"
_compute_delete_opts="$_compute_global_opts --yes --save-volumes"
_compute_complete_instances()
{
@ -49,12 +60,19 @@ _compute_complete_instances()
_compute_compreply()
{
local cgopts=
if [[ "$1" == '-f' ]]; then
cgopts="-f"
shift
fi
if [[ "$current" = [a-z]* ]]; then
_compute_compwords="$(_compute_complete_instances)"
else
_compute_compwords="$*"
fi
COMPREPLY=($(compgen -W "$_compute_compwords" -- "$current"))
COMPREPLY=($(compgen $cgopts -W "$_compute_compwords" -- "$current"))
}
_compute_complete()
@ -68,9 +86,10 @@ _compute_complete()
nshift=$((COMP_CWORD-1))
previous="${COMP_WORDS[COMP_CWORD-nshift]}"
case "$previous" in
init) COMPREPLY=($(compgen -f -- "$current"));;
init) COMPREPLY=($(compgen -f -W "$_compute_init_opts" -- "$current"));;
exec) _compute_compreply "$_compute_exec_opts";;
ls) COMPREPLY=($(compgen -W "$_compute_ls_opts" -- "$current"));;
lsdisks) _compute_compreply "$_compute_lsdisks_opts";;
start) _compute_compreply "$_compute_start_opts";;
shutdown) _compute_compreply "$_compute_shutdown_opts";;
reboot) _compute_compreply "$_compute_reboot_opts";;
@ -83,6 +102,7 @@ _compute_complete()
setmem) _compute_compreply "$_compute_setmem_opts";;
setpass) _compute_compreply "$_compute_setpass_opts";;
setcdrom) _compute_compreply "$_compute_setcdrom_opts";;
setcloudinit) _compute_compreply -f "$_compute_setcloudinit_opts";;
delete) _compute_compreply "$_compute_delete_opts";;
*) COMPREPLY=()
esac