summaryrefslogtreecommitdiffstats
path: root/completion/pacstrap.bash
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@ubuntu.com>2019-07-03 05:08:20 -0400
committerLibravatarUnit 193 <unit193@ubuntu.com>2019-07-03 05:08:20 -0400
commit0d2edecb2be14c0ed92a33c7508358d648cd3d2f (patch)
tree0d4a3d9906a7c6996d63d1eceb2df145e2a633c0 /completion/pacstrap.bash
parentcc216920a0867905b9110ef51bf29e576364b175 (diff)
New upstream version 22upstream/22
Diffstat (limited to 'completion/pacstrap.bash')
-rw-r--r--completion/pacstrap.bash38
1 files changed, 38 insertions, 0 deletions
diff --git a/completion/pacstrap.bash b/completion/pacstrap.bash
new file mode 100644
index 0000000..fb948f0
--- /dev/null
+++ b/completion/pacstrap.bash
@@ -0,0 +1,38 @@
+if ! declare -F _pacman_pkg > /dev/null; then
+ _completion_loader pacman
+fi
+
+_pacstrap() {
+ compopt +o dirnames +o default
+ local cur prev opts
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ opts="-C -c -G -i -M -h"
+
+ for i in "${COMP_WORDS[@]:1:COMP_CWORD-1}"; do
+ if [[ -d ${i} ]]; then
+ _pacman_pkg Slq
+ return 0
+ fi
+ done
+
+ case ${prev} in
+ -h)
+ return 0
+ ;;
+ -C)
+ compopt -o default
+ return 0
+ ;;
+ esac
+
+ if [[ ${cur} = -* ]]; then
+ COMPREPLY=($(compgen -W "${opts}" -- "${cur}"))
+ return 0
+ fi
+
+ compopt -o dirnames
+}
+
+complete -F _pacstrap pacstrap