summaryrefslogtreecommitdiffstats
path: root/bash-completion
diff options
context:
space:
mode:
authorSebastien Luttringer <seblu@seblu.net>2011-06-18 06:49:30 +0200
committerSebastien Luttringer <seblu@seblu.net>2011-06-26 23:15:56 +0200
commitb130e5d9f622c05863a889052d7bf9eac5c0af58 (patch)
tree5575728fd44cf88aa3c7fdf2aeb8bb8e1344176d /bash-completion
parent18eb47e46e0630638011e05cd549ec5d8e0bf490 (diff)
downloadmkinitcpio-b130e5d9f622c05863a889052d7bf9eac5c0af58.tar.gz
mkinitcpio-b130e5d9f622c05863a889052d7bf9eac5c0af58.tar.xz
Add bash completion to mkinitcpio
It's annoying to remember the name of preset each time Signed-off-by: Sebastien Luttringer <seblu@seblu.net>
Diffstat (limited to 'bash-completion')
-rw-r--r--bash-completion20
1 files changed, 20 insertions, 0 deletions
diff --git a/bash-completion b/bash-completion
new file mode 100644
index 0000000..ddb60e2
--- /dev/null
+++ b/bash-completion
@@ -0,0 +1,20 @@
+# mkinitcpio bash completion by Seblu <seblu@seblu.net>
+
+_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
+
+# vim: set ts=2 sw=2 ft=sh noet: