completion/bash/arch-chroot
raw| 1 | _arch_chroot() { |
| 2 | compopt +o dirnames |
| 3 | local cur prev opts i |
| 4 | _init_completion -n : || return |
| 5 | opts="-N -u -r -h" |
| 6 | |
| 7 | for i in "${COMP_WORDS[@]:1:COMP_CWORD-1}"; do |
| 8 | if [[ -d ${i} ]]; then |
| 9 | return 0 |
| 10 | fi |
| 11 | done |
| 12 | |
| 13 | if [[ ${prev} = -u ]]; then |
| 14 | _usergroup -u |
| 15 | return 0 |
| 16 | fi |
| 17 | |
| 18 | if [[ ${cur} = -* ]]; then |
| 19 | COMPREPLY=($(compgen -W "${opts}" -- "${cur}")) |
| 20 | return 0 |
| 21 | fi |
| 22 | compopt -o dirnames |
| 23 | } |
| 24 | |
| 25 | complete -F _arch_chroot arch-chroot |