mirror_lxc/config/bash/lxc.in
Johannes Kastl c18d419f7c removed shebang from bash_completion-file
Signed-off-by: Johannes Kastl <git@ojkastl.de>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-03-03 10:57:41 -05:00

104 lines
2.4 KiB
Plaintext

have lxc-start && {
_lxc_names() {
COMPREPLY=( $( compgen -W "$( lxc-ls )" "$cur" ) )
}
_lxc_states() {
COMPREPLY=( $( compgen -W "STOPPED STARTING RUNNING STOPPING ABORTING FREEZING FROZEN THAWED" "$cur" ) )
}
_lxc_templates() {
COMPREPLY=( $( compgen -W "$(ls @LXCTEMPLATEDIR@/ | sed -e 's|^lxc-||' )" "$cur" ) )
}
_lxc-generic-n() {
local cur prev
COMPREPLY=()
_get_comp_words_by_ref cur prev
case $prev in
-n)
_lxc_names "$cur"
return 0
;;
esac
return 1
}
_lxc-generic-ns() {
local cur prev
COMPREPLY=()
_get_comp_words_by_ref cur prev
case $prev in
-n)
_lxc_names "$cur"
return 0
;;
-s)
_lxc_states "$cur"
return 0
;;
esac
return 1
}
_lxc-generic-t() {
local cur prev
COMPREPLY=()
_get_comp_words_by_ref cur prev
case $prev in
-t)
_lxc_templates "$cur"
return 0
;;
esac
return 1
}
_lxc-generic-o() {
local cur prev
COMPREPLY=()
_get_comp_words_by_ref cur prev
case $prev in
-o)
_lxc_names "$cur"
return 0
;;
esac
return 1
}
complete -o default -F _lxc-generic-n lxc-attach
complete -o default -F _lxc-generic-n lxc-cgroup
complete -o default -F _lxc-generic-n lxc-console
complete -o default -F _lxc-generic-n lxc-destroy
complete -o default -F _lxc-generic-n lxc-device
complete -o default -F _lxc-generic-n lxc-execute
complete -o default -F _lxc-generic-n lxc-freeze
complete -o default -F _lxc-generic-n lxc-info
complete -o default -F _lxc-generic-n lxc-monitor
complete -o default -F _lxc-generic-n lxc-snapshot
complete -o default -F _lxc-generic-n lxc-start
complete -o default -F _lxc-generic-n lxc-stop
complete -o default -F _lxc-generic-n lxc-unfreeze
complete -o default -F _lxc-generic-ns lxc-wait
complete -o default -F _lxc-generic-t lxc-create
complete -o default -F _lxc-generic-o lxc-clone
complete -o default -F _lxc-generic-o lxc-start-ephemeral
}