Skip to content

Commit

Permalink
Merge #788
Browse files Browse the repository at this point in the history
788: Fix various autocomplete bugs r=gerboland a=townsend2010

Fixes #700, fixes #714, fixes #716 

Co-authored-by: Chris Townsend <[email protected]>
  • Loading branch information
2 people authored and Saviq committed May 28, 2019
1 parent 2d22608 commit ba8e740
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions completions/bash/multipass
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,12 @@ _multipass_complete()
"mount")
opts="${opts} --gid-map --uid-map"
;;
"recover"|"start"|"stop"|"suspend"|"restart")
"recover"|"start"|"suspend"|"restart")
opts="${opts} --all"
;;
"stop")
opts="${opts} --all --cancel --time"
;;
"find")
opts="${opts} --show-unsupported"
;;
Expand All @@ -89,18 +92,23 @@ _multipass_complete()

if [[ "$prev_opts" = false ]]; then
case "${cmd}" in
"connect"|"sh"|"shell"|"exec"|"stop"|"suspend"|"restart")
_multipass_instances "RUNNING"
"exec"|"stop"|"suspend"|"restart")
_multipass_instances "Running"
;;
"connect"|"sh"|"shell")
_multipass_instances "Running"
_multipass_instances "Stopped"
_multipass_instances "Suspended"
;;
"start")
_multipass_instances "STOPPED"
_multipass_instances "SUSPENDED"
_multipass_instances "Stopped"
_multipass_instances "Suspended"
;;
"delete"|"info"|"umount"|"unmount")
_multipass_instances
;;
"recover")
_multipass_instances "DELETED"
_multipass_instances "Deleted"
;;
"mount")
local source_set=0
Expand All @@ -122,11 +130,13 @@ _multipass_complete()
return
fi
elif [ ${source_set} == 1 ] && [[ ${prev} != -* ]]; then
_multipass_instances
_multipass_instances "Running"
_multipass_instances "Stopped"
_multipass_instances "Suspended"
fi
;;
"transfer"|"copy-files")
_multipass_instances "RUNNING"
_multipass_instances "Running"

COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
if [[ "${#COMPREPLY[@]}" == "0" ]]; then
Expand Down

0 comments on commit ba8e740

Please sign in to comment.