diff --git a/README b/README index 7bdf3f0..3d004f6 100644 --- a/README +++ b/README @@ -1,10 +1,10 @@ VBoxManage bash completion script. -This version of the completion was initially based on Sebastian T. Hafner -script. However, in some point of time I've decided to rewrite it almost from +This version of the completion was initially based on Sebastian T. Hafner +script. However, in some point of time I've decided to rewrite it almost from scratch. -Current version of script was written and tested against VBoxManage in version +Current version of script was written and tested against VBoxManage in version 4.3.18, and supports commands: - adoptstate @@ -14,6 +14,7 @@ Current version of script was written and tested against VBoxManage in version - closemedium - controlvm - convertfromraw +- createhd - list - showhdinfo - showvminfo diff --git a/VBoxManage b/VBoxManage index 1413d88..c605305 100644 --- a/VBoxManage +++ b/VBoxManage @@ -15,7 +15,7 @@ # [x] closemedium # [x] controlvm # [x] convertfromraw -# [ ] createhd +# [x] createhd # [ ] createvm # [ ] debugvm # [ ] dhcpserver @@ -553,6 +553,33 @@ _VBoxManage() { fi ;; createhd) + items=(--filename --size --sizebyte --diffparent --format --variant) + if [[ ${prev} == ${cmd} ]]; then + COMPREPLY=( $(compgen -W "${items[*]}" -- ${cur}) ) + else + [[ " ${COMP_WORDS[@]} " == *" --size "* || + " ${COMP_WORDS[@]} " == *" --sizebyte "* ]] && + items=(--filename --diffparent --format --variant) + _get_excluded_items "${items[@]}" + COMPREPLY=( $(compgen -W "$result" -- ${cur}) ) + + case "${prev}" in + --filename) + COMPREPLY=( $(compgen -- ${cur}) ) + ;; + --diffparent) + COMPREPLY=() + _hdd_comp ${cur} + ;; + --format) + COMPREPLY=( $(compgen -W "VDI VMDK VHD" -- ${cur}) ) + ;; + --variant) + COMPREPLY=( $(compgen -W "Standard Fixed Split2G Stream + ESX" -- ${cur}) ) + ;; + esac + fi ;; createvm) ;;