[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 6571c6685c0bbfa6aac999fdc18299594293d83e
Ville Skyttä
ville.skytta at iki.fi
Tue Jun 29 16:32:24 UTC 2010
The following commit has been merged in the master branch:
commit 6571c6685c0bbfa6aac999fdc18299594293d83e
Author: Ville Skyttä <ville.skytta at iki.fi>
Date: Tue Jun 29 19:23:26 2010 +0300
Add sqlite3 option completions, include *.db in filename ones (Alioth: 312605).
diff --git a/CHANGES b/CHANGES
index ab436c2..05ac17a 100644
--- a/CHANGES
+++ b/CHANGES
@@ -8,7 +8,7 @@ bash-completion (2.x)
* Add crontab and lrzip completions.
* Add gif to mplayer filename completions (Alioth: #312512).
* Add "short" tarball extensions to unxz, unlzma etc completions.
- * Improve /etc/init.d/* completions.
+ * Improve /etc/init.d/* and sqlite3 completions.
-- David Paleino <d.paleino at gmail.com> Wed, 16 Jun 2010 17:53:22 +0200
diff --git a/Makefile.am b/Makefile.am
index f83171e..331d234 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -139,6 +139,7 @@ bashcomp_DATA = contrib/abook \
contrib/sitecopy \
contrib/smartctl \
contrib/snownews \
+ contrib/sqlite3 \
contrib/ssh \
contrib/sshfs \
contrib/strace \
diff --git a/bash_completion b/bash_completion
index 2f60404..53eea33 100644
--- a/bash_completion
+++ b/bash_completion
@@ -115,7 +115,6 @@ complete -f -X '!*.@(sxd|std|sda|sdd|odg|otg)' oodraw
complete -f -X '!*.@(sxm|smf|mml|odf)' oomath
complete -f -X '!*.odb' oobase
complete -f -X '!*.rpm' rpm2cpio
-complete -f -X '!*.s@(qlite?(3)|?(3)db)' sqlite3
complete -f -X '!*.aux' bibtex
complete -f -X '!*.po' poedit gtranslator kbabel lokalize
complete -f -X '!*.@([Pp][Rr][Gg]|[Cc][Ll][Pp])' harbour gharbour hbpp
diff --git a/contrib/sqlite3 b/contrib/sqlite3
new file mode 100644
index 0000000..f02b2e0
--- /dev/null
+++ b/contrib/sqlite3
@@ -0,0 +1,39 @@
+# sqlite3(1) completion
+
+have sqlite3 &&
+_sqlite3()
+{
+ COMPREPLY=()
+ local cur prev
+ _get_comp_words_by_ref cur prev
+
+ local dbexts='@(sqlite?(3)|?(s?(3))db)'
+
+ case $prev in
+ -help|-version|-separator|-nullvalue|*.$dbexts)
+ return 0
+ ;;
+ -init)
+ _filedir
+ return 0
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-help -init -echo -header -noheader -bail
+ -interactive -batch -column -csv -html -line -list -separator
+ -nullvalue -version' -- "$cur" ) )
+ return 0
+ fi
+
+ _filedir $dbexts
+} &&
+complete -F _sqlite3 -o filenames sqlite3
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/test/completion/sqlite3.exp b/test/completion/sqlite3.exp
new file mode 100644
index 0000000..88195e0
--- /dev/null
+++ b/test/completion/sqlite3.exp
@@ -0,0 +1 @@
+assert_source_completions sqlite3
diff --git a/test/lib/completions/animate.exp b/test/lib/completions/sqlite3.exp
similarity index 79%
copy from test/lib/completions/animate.exp
copy to test/lib/completions/sqlite3.exp
index 12314d7..af1ada8 100644
--- a/test/lib/completions/animate.exp
+++ b/test/lib/completions/sqlite3.exp
@@ -11,7 +11,7 @@ proc teardown {} {
setup
-assert_complete_any "animate "
+assert_complete_any "sqlite3 "
sync_after_int
--
bash-completion
More information about the Bash-completion-commits
mailing list