[Bash-completion-commits] [SCM] bash-completion branch, master, updated. a6f79a9a6967dad79a019bdfd9e1a8ed45bead68
Ville Skyttä
ville.skytta at iki.fi
Mon Nov 30 21:02:45 UTC 2009
The following commit has been merged in the master branch:
commit a6f79a9a6967dad79a019bdfd9e1a8ed45bead68
Author: Ville Skyttä <ville.skytta at iki.fi>
Date: Mon Nov 30 23:01:32 2009 +0200
Add jarsigner, pack200, and unpack200 completions.
diff --git a/CHANGES b/CHANGES
index a4918fa..0e7cc5e 100644
--- a/CHANGES
+++ b/CHANGES
@@ -26,7 +26,7 @@ bash-completion (2.x)
* Improve configure, cvs, gkrellm, lftp, mdadm, modprobe, mplayer,
mysqladmin, service, scp, ssh, and general hostname completions.
* Add abook and wtf completion, based on work by Raphaël Droz.
- * Add k3b and lftpget completion.
+ * Add jarsigner, k3b, lftpget, pack200 and unpack200 completions.
* Don't overwrite other host completions when completing from multiple
SSH known hosts files.
* Speed up installed rpm package completion on SUSE, based on work by
diff --git a/contrib/java b/contrib/java
index 70f98d4..068a918 100644
--- a/contrib/java
+++ b/contrib/java
@@ -250,6 +250,172 @@ _javac()
} &&
complete -F _javac -o filenames javac
+have pack200 &&
+_pack200()
+{
+ COMPREPLY=()
+ local cur=`_get_cword` prev=`_get_pword`
+
+ case "$prev" in
+ -S|--segment-limit|-P|--pass-file|-C|--class-attribute|\
+ -F|--field-attribute|-M|--method-attribute|-D|--code-attribute|\
+ '-?'|-h|--help|-V|--version|-J)
+ return 0
+ ;;
+ -E|--effort)
+ COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9' -- "$cur" ) )
+ return 0
+ ;;
+ -H|--deflate-hint)
+ COMPREPLY=( $( compgen -W 'true false keep' -- "$cur" ) )
+ return 0
+ ;;
+ -m|--modification-time)
+ COMPREPLY=( $( compgen -W 'latest keep' -- "$cur" ) )
+ return 0
+ ;;
+ -U|--unknown-attribute)
+ COMPREPLY=( $( compgen -W 'error strip pass' -- "$cur" ) )
+ return 0
+ ;;
+ -f|--config-file)
+ _filedir properties
+ return 0
+ ;;
+ -l|--log-file)
+ COMPREPLY=( $( compgen -W '-' -- "$cur" ) )
+ _filedir log
+ return 0
+ ;;
+ esac
+
+ # Check if a pack or a jar was already given.
+ local i pack=false jar=false
+ for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )) ; do
+ case "${COMP_WORDS[i]}" in
+ *.pack|*.pack.gz) pack=true ;;
+ *.jar) jar=true ;;
+ esac
+ done
+
+ if ! $pack ; then
+ if [[ "$cur" == -* ]] ; then
+ COMPREPLY=( $( compgen -W '--no-gzip --gzip --strip-debug \
+ --no-keep-file-order --segment-limit= --effort= \
+ --deflate-hint= --modification-time= --pass-file= \
+ --unknown-attribute= --class-attribute= --field-attribute= \
+ --method-attribute= --code-attribute= --config-file= \
+ --verbose --quiet --log-file= --help --version -J' -- "$cur" ) )
+ [[ ${#COMPREPLY[@]} -eq 1 && ${COMPREPLY[0]} == *= ]] && \
+ type compopt &>/dev/null && compopt -o nospace
+ else
+ _filedir 'pack?(.gz)'
+ fi
+ elif ! $jar ; then
+ _filedir jar
+ fi
+} &&
+complete -F _pack200 pack200
+
+have unpack200 &&
+_unpack200()
+{
+ COMPREPLY=()
+ local cur=`_get_cword` prev=`_get_pword`
+
+ case "$prev" in
+ '-?'|-h|--help|-V|--version|-J)
+ return 0
+ ;;
+ -H|--deflate-hint)
+ COMPREPLY=( $( compgen -W 'true false keep' -- "$cur" ) )
+ return 0
+ ;;
+ -l|--log-file)
+ COMPREPLY=( $( compgen -W '-' -- "$cur" ) )
+ _filedir log
+ return 0
+ ;;
+ esac
+
+ # Check if a pack or a jar was already given.
+ local i pack=false jar=false
+ for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )) ; do
+ case "${COMP_WORDS[i]}" in
+ *.pack|*.pack.gz) pack=true ;;
+ *.jar) jar=true ;;
+ esac
+ done
+
+ if ! $pack ; then
+ if [[ "$cur" == -* ]] ; then
+ COMPREPLY=( $( compgen -W '--deflate-hint= --remove-pack-file \
+ --verbose --quiet --log-file= --help --version' -- "$cur" ) )
+ [[ ${#COMPREPLY[@]} -eq 1 && ${COMPREPLY[0]} == *= ]] && \
+ type compopt &>/dev/null && compopt -o nospace
+ else
+ _filedir 'pack?(.gz)'
+ fi
+ elif ! $jar ; then
+ _filedir jar
+ fi
+} &&
+complete -F _unpack200 unpack200
+
+have jarsigner &&
+_jarsigner()
+{
+ COMPREPLY=()
+ local cur=`_get_cword` prev=`_get_pword`
+
+ case "$prev" in
+ -keystore)
+ COMPREPLY=( $( compgen -W 'NONE' -- "$cur" ) )
+ _filedir '@(jks|ks|p12|pfx)'
+ return 0
+ ;;
+ -storepass|-keypass|-sigfile|-digestalg|-sigalg|-tsacert|-altsigner|\
+ -altsignerpath|-providerName|-providerClass|-providerArg)
+ return 0
+ ;;
+ -storetype)
+ COMPREPLY=( $( compgen -W 'JKS PKCS11 PKCS12' -- "$cur" ) )
+ return 0
+ ;;
+ -signedjar)
+ _filedir jar
+ return 0
+ ;;
+ -tsa)
+ _filedir
+ return 0
+ ;;
+ esac
+
+ # Check if a jar was already given.
+ local i jar=false
+ for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )) ; do
+ if [[ "${COMP_WORDS[i]}" == *.jar && \
+ "${COMP_WORDS[i-1]}" != -signedjar ]] ; then
+ jar=true
+ break
+ fi
+ done
+
+ if ! $jar ; then
+ if [[ "$cur" == -* ]] ; then
+ # Documented as "should not be used": -internalsf, -sectionsonly
+ COMPREPLY=( $( compgen -W '-keystore -storepass -storetype \
+ -keypass -sigfile -signedjar -digestalg -sigalg -verify \
+ -verbose -certs -tsa -tsacert -altsigner -altsignerpath \
+ -protected -providerName -providerClass -providerArg' \
+ -- "$cur" ) )
+ fi
+ _filedir jar
+ fi
+} &&
+complete -F _jarsigner -o filenames jarsigner
+
# Local variables:
# mode: shell-script
# sh-basic-offset: 4
diff --git a/test/completion/jarsigner.exp b/test/completion/jarsigner.exp
new file mode 100644
index 0000000..2967267
--- /dev/null
+++ b/test/completion/jarsigner.exp
@@ -0,0 +1,3 @@
+if {[assert_bash_type jarsigner]} {
+ source "lib/completions/jarsigner.exp"
+}; # if
diff --git a/test/completion/pack200.exp b/test/completion/pack200.exp
new file mode 100644
index 0000000..db43532
--- /dev/null
+++ b/test/completion/pack200.exp
@@ -0,0 +1,3 @@
+if {[assert_bash_type pack200]} {
+ source "lib/completions/pack200.exp"
+}; # if
diff --git a/test/completion/unpack200.exp b/test/completion/unpack200.exp
new file mode 100644
index 0000000..1aa7d21
--- /dev/null
+++ b/test/completion/unpack200.exp
@@ -0,0 +1,3 @@
+if {[assert_bash_type unpack200]} {
+ source "lib/completions/unpack200.exp"
+}; # if
diff --git a/test/lib/completions/abook.exp b/test/lib/completions/jarsigner.exp
similarity index 81%
copy from test/lib/completions/abook.exp
copy to test/lib/completions/jarsigner.exp
index 3f4e301..075e026 100644
--- a/test/lib/completions/abook.exp
+++ b/test/lib/completions/jarsigner.exp
@@ -11,7 +11,7 @@ proc teardown {} {
setup
-assert_complete_any "abook "
+assert_complete_any "jarsigner "
sync_after_int
diff --git a/test/lib/completions/abook.exp b/test/lib/completions/pack200.exp
similarity index 82%
copy from test/lib/completions/abook.exp
copy to test/lib/completions/pack200.exp
index 3f4e301..f96eff1 100644
--- a/test/lib/completions/abook.exp
+++ b/test/lib/completions/pack200.exp
@@ -11,7 +11,7 @@ proc teardown {} {
setup
-assert_complete_any "abook "
+assert_complete_any "pack200 "
sync_after_int
diff --git a/test/lib/completions/abook.exp b/test/lib/completions/unpack200.exp
similarity index 81%
copy from test/lib/completions/abook.exp
copy to test/lib/completions/unpack200.exp
index 3f4e301..845701d 100644
--- a/test/lib/completions/abook.exp
+++ b/test/lib/completions/unpack200.exp
@@ -11,7 +11,7 @@ proc teardown {} {
setup
-assert_complete_any "abook "
+assert_complete_any "unpack200 "
sync_after_int
--
bash-completion
More information about the Bash-completion-commits
mailing list