2019-06-05 12:06:59 -07:00
|
|
|
_arch_chroot() {
|
|
|
|
compopt +o dirnames
|
2021-03-10 18:32:37 -08:00
|
|
|
local cur prev opts i
|
2019-12-23 16:44:07 -08:00
|
|
|
_init_completion -n : || return
|
2021-11-17 11:08:10 -08:00
|
|
|
opts="-N -u -h"
|
2019-06-05 12:06:59 -07:00
|
|
|
|
|
|
|
for i in "${COMP_WORDS[@]:1:COMP_CWORD-1}"; do
|
|
|
|
if [[ -d ${i} ]]; then
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if [[ ${prev} = -u ]]; then
|
|
|
|
_usergroup -u
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ ${cur} = -* ]]; then
|
|
|
|
COMPREPLY=($(compgen -W "${opts}" -- "${cur}"))
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
compopt -o dirnames
|
|
|
|
}
|
|
|
|
|
|
|
|
complete -F _arch_chroot arch-chroot
|