diff options
Diffstat (limited to 'usr/src/cmd/nsadmin/bash/bash_completion.d/machines')
-rw-r--r-- | usr/src/cmd/nsadmin/bash/bash_completion.d/machines | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/usr/src/cmd/nsadmin/bash/bash_completion.d/machines b/usr/src/cmd/nsadmin/bash/bash_completion.d/machines new file mode 100644 index 0000000000..05de1b75a4 --- /dev/null +++ b/usr/src/cmd/nsadmin/bash/bash_completion.d/machines @@ -0,0 +1,19 @@ +_machine() +{ + local cur prev opts base + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + + if [[ ${prev} == 'machine-json' ]]; then + machines=$(zoneadm list -cp | grep -v ':global:' | cut -d':' -f2,5 | tr ':' '\n' | sort | uniq) + COMPREPLY=( $(compgen -W "${machines}" -- ${cur}) ) + else + # Just expand files by default + COMPREPLY=( $(compgen -f -- ${cur}) ) + fi + + return 0 +} + +complete -F _machine machine-json |