summaryrefslogtreecommitdiffstats
path: root/bash-completion
diff options
context:
space:
mode:
authorThomas Bächler <thomas@archlinux.org>2011-06-26 23:18:44 +0200
committerThomas Bächler <thomas@archlinux.org>2011-06-26 23:18:44 +0200
commit027ddb69122af89c89aa50906eec045f349c9490 (patch)
treef8350d984b5c3feee85f9613de4314d49d54aadb /bash-completion
parent60c079c11435e9e120cc6ebb991071e321b20639 (diff)
parentf58be6cc8d802c4c48edd594aab41408df30e954 (diff)
downloadmkinitcpio-027ddb69122af89c89aa50906eec045f349c9490.tar.gz
mkinitcpio-027ddb69122af89c89aa50906eec045f349c9490.tar.xz
Merge branch 'master' of https://github.com/seblu/arch-mkinitcpio into working
Diffstat (limited to 'bash-completion')
-rw-r--r--bash-completion32
1 files changed, 32 insertions, 0 deletions
diff --git a/bash-completion b/bash-completion
new file mode 100644
index 0000000..50cbb8e
--- /dev/null
+++ b/bash-completion
@@ -0,0 +1,32 @@
+# mkinitcpio bash completion by Seblu <seblu@seblu.net>
+
+_lsinitcpio ()
+{
+ local action="-a -h -v -x"
+ local cur="${COMP_WORDS[COMP_CWORD]}"
+ local caction="${COMP_WORDS[COMP_CWORD]}"
+ case "$caction" in
+ -*) COMPREPLY=($(compgen -W "${action}" -- "$cur"));;
+ *) _filedir;;
+ esac
+}
+
+_mkinitcpio ()
+{
+ local action="-c -k -s -b -g -a -p -m -S -v -M -L -H -h"
+ local cur="${COMP_WORDS[COMP_CWORD]}"
+ local caction="${COMP_WORDS[COMP_CWORD-1]}"
+ case "$caction" in
+ -c|-g|-s|-a) _filedir;;
+ -k) COMPREPLY=($(cd /lib/modules && compgen -d -- $cur));;
+ -b) COMPREPLY=($(compgen -d "$cur" -- $cur));;
+ -p) COMPREPLY=($(cd /etc/mkinitcpio.d/ && compgen -X '!*.preset' -f -- $cur|sed 's/\.preset//'));;
+ -H|-S) COMPREPLY=($(cd /lib/initcpio/install/ && compgen -f -- $cur));;
+ -m) COMPREPLY=();;
+ *) COMPREPLY=($(compgen -W "${action}" -- "$cur"));;
+ esac
+}
+complete -F _mkinitcpio mkinitcpio
+complete -F _lsinitcpio lsinitcpio
+
+# vim: set ts=2 sw=2 ft=sh noet: