diff options
| author | 2019-07-03 05:08:20 -0400 | |
|---|---|---|
| committer | 2019-07-03 05:08:20 -0400 | |
| commit | 0d2edecb2be14c0ed92a33c7508358d648cd3d2f (patch) | |
| tree | 0d4a3d9906a7c6996d63d1eceb2df145e2a633c0 /completion/arch-chroot.bash | |
| parent | cc216920a0867905b9110ef51bf29e576364b175 (diff) | |
New upstream version 22upstream/22
Diffstat (limited to 'completion/arch-chroot.bash')
| -rw-r--r-- | completion/arch-chroot.bash | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/completion/arch-chroot.bash b/completion/arch-chroot.bash new file mode 100644 index 0000000..37fbf7c --- /dev/null +++ b/completion/arch-chroot.bash @@ -0,0 +1,27 @@ +_arch_chroot() { + compopt +o dirnames + local cur prev opts + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + opts="-u -h" + + 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 |
