[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.3-413-gb1f2402

Ville Skyttä ville.skytta at iki.fi
Sun Jul 24 10:19:19 UTC 2011


The following commit has been merged in the master branch:
commit b1f2402bfd9ff901b2b4e0879afe3d660e1ee5e5
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Sun Jul 24 13:16:44 2011 +0300

    cal: New completion.

diff --git a/completions/Makefile.am b/completions/Makefile.am
index 89d4c62..21d564e 100644
--- a/completions/Makefile.am
+++ b/completions/Makefile.am
@@ -16,6 +16,7 @@ bashcomp_DATA = abook \
 		bluez \
 		brctl \
 		bzip2 \
+		cal \
 		cardctl \
 		cfengine \
 		chkconfig \
diff --git a/completions/cal b/completions/cal
new file mode 100644
index 0000000..e2195a6
--- /dev/null
+++ b/completions/cal
@@ -0,0 +1,40 @@
+have cal || have ncal || return
+
+_cal()
+{
+    local cur prev words cword
+    _init_completion || return
+
+    case $prev in
+        -m)
+            if [[ $OSTYPE == *bsd* ]]; then
+                COMPREPLY=( $( compgen -W '{1..12}' -- "$cur" ) )
+                return
+            fi
+            ;;
+        -s)
+            [[ $OSTYPE == *bsd* ]] && return
+            ;;
+        -A|-B|-d|-H)
+            return
+            ;;
+    esac
+
+    if [[ $cur == -* ]]; then
+        COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) )
+        return
+    fi
+
+    local args
+    _count_args
+    [[ $args -eq 1 ]] && COMPREPLY=( $( compgen -W '{1..12}' -- "$cur" ) )
+} &&
+complete -F _cal cal ncal
+
+# 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/cal.exp b/test/completion/cal.exp
new file mode 100644
index 0000000..5fba48b
--- /dev/null
+++ b/test/completion/cal.exp
@@ -0,0 +1 @@
+assert_source_completions cal
diff --git a/test/lib/completions/c++.exp b/test/lib/completions/cal.exp
similarity index 81%
copy from test/lib/completions/c++.exp
copy to test/lib/completions/cal.exp
index c899de2..bf7185e 100644
--- a/test/lib/completions/c++.exp
+++ b/test/lib/completions/cal.exp
@@ -11,7 +11,7 @@ proc teardown {} {
 setup
 
 
-assert_complete_any "c++ "
+assert_complete_any "cal "
 
 
 sync_after_int

-- 
bash-completion



More information about the Bash-completion-commits mailing list