Skip to content

Commit

Permalink
Merge pull request #13169 from simondeziel/bash-comp
Browse files Browse the repository at this point in the history
Few improvements to bash completion
  • Loading branch information
tomponline committed Mar 19, 2024
2 parents e319c51 + 1a11af2 commit 4b4fe7a
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions scripts/bash/lxd-client
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ _have lxc && {
local state=$1
local keys=$2
local project
project=$(lxc project list -f csv | sed -n 's/^\([^(]\+\) (current),.*/\1/ p')
project=$(lxc project list --format=csv | sed -n 's/^\([^(]\+\) (current),.*/\1/ p')
project=${project:-"default"}

local cmd="lxc list --format=csv --columns=ns --project $project"
Expand All @@ -19,7 +19,7 @@ _have lxc && {

_lxd_images()
{
COMPREPLY=( $( compgen -W "$( lxc image list --format=csv | cut -d, -f1 )" "$cur" ) )
COMPREPLY=( $( compgen -W "$( lxc image list --format=csv --columns=l )" "$cur" ) )
}

_lxd_remotes()
Expand Down Expand Up @@ -175,7 +175,7 @@ _have lxc && {
security.unmapped security.shifted zfs.remove_snapshots zfs.use_refquota zfs.reserve_space
zfs.delegate"

auth_entity_types="server group image instance network profile project storage_pool storage_volume"
auth_entity_types="server group image instance network profile project storage storage_volume"

if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=( $(compgen -W "$lxc_cmds" -- ${COMP_WORDS[COMP_CWORD]}) )
Expand Down Expand Up @@ -377,7 +377,7 @@ _have lxc && {
"network")
case $pos in
2)
COMPREPLY=( $(compgen -W "list show create get set unset delete edit rename attach attach-profile detach detach-profile info acl forward list-leases load-balancer peer zone" -- $cur) )
COMPREPLY=( $(compgen -W "acl attach attach-profile create delete detach detach-profile edit forward get info list list-allocations list-leases load-balancer peer rename set show unset zone" -- $cur) )
;;
3)
case ${no_dashargs[2]} in
Expand Down Expand Up @@ -484,14 +484,14 @@ _have lxc && {
;;
esac
;;
"storage_pools")
"storage")
case $pos in
2)
COMPREPLY=( $(compgen -W "list show create get set unset delete edit" -- $cur) )
COMPREPLY=( $(compgen -W "bucket create delete edit get info list set show unset volume" -- $cur) )
;;
3)
case ${no_dashargs[2]} in
"show"|"get"|"set"|"unset"|"delete"|"edit")
"delete"|"edit"|"get"|"info"|"set"|"show"|"unset")
_lxd_storage_pools
;;
esac
Expand Down

0 comments on commit 4b4fe7a

Please sign in to comment.