From b130e5d9f622c05863a889052d7bf9eac5c0af58 Mon Sep 17 00:00:00 2001 From: Sebastien Luttringer Date: Sat, 18 Jun 2011 06:49:30 +0200 Subject: Add bash completion to mkinitcpio It's annoying to remember the name of preset each time Signed-off-by: Sebastien Luttringer --- bash-completion | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 bash-completion (limited to 'bash-completion') 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 + +_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: -- cgit v1.2.3-24-g4f1b From f58be6cc8d802c4c48edd594aab41408df30e954 Mon Sep 17 00:00:00 2001 From: Sebastien Luttringer Date: Sun, 26 Jun 2011 23:15:29 +0200 Subject: Add lsinitcpio bash completion Signed-off-by: Sebastien Luttringer --- bash-completion | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'bash-completion') diff --git a/bash-completion b/bash-completion index ddb60e2..50cbb8e 100644 --- a/bash-completion +++ b/bash-completion @@ -1,5 +1,16 @@ # mkinitcpio bash completion by Seblu +_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" @@ -16,5 +27,6 @@ _mkinitcpio () esac } complete -F _mkinitcpio mkinitcpio +complete -F _lsinitcpio lsinitcpio # vim: set ts=2 sw=2 ft=sh noet: -- cgit v1.2.3-24-g4f1b