[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.3-400-gb68cc00

Ville Skyttä ville.skytta at iki.fi
Mon Jul 11 21:07:44 UTC 2011


The following commit has been merged in the master branch:
commit b68cc0057f605fefcba540fef993ec72a4ee2407
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Tue Jul 12 00:07:35 2011 +0300

    curl: New non-generic completion.

diff --git a/bash_completion b/bash_completion
index 6c3cd73..6297bb8 100644
--- a/bash_completion
+++ b/bash_completion
@@ -1693,7 +1693,7 @@ _longopt()
 }
 # makeinfo and texi2dvi are defined elsewhere.
 for i in a2ps awk bash bc bison cat colordiff cp csplit \
-    curl cut date df diff dir du enscript env expand fmt fold gperf gprof \
+    cut date df diff dir du enscript env expand fmt fold gperf gprof \
     grep grub head indent irb ld ldd less ln ls m4 md5sum mkdir mkfifo mknod \
     mv netstat nl nm objcopy objdump od paste patch pr ptx readelf rm rmdir \
     sed seq sha{,1,224,256,384,512}sum shar sort split strip sum tac tail tee \
diff --git a/completions/Makefile.am b/completions/Makefile.am
index b009fbc..dce9047 100644
--- a/completions/Makefile.am
+++ b/completions/Makefile.am
@@ -30,6 +30,7 @@ bashcomp_DATA = abook \
 		cppcheck \
 		crontab \
 		cups \
+		curl \
 		cryptsetup \
 		cvs \
 		cvsps \
diff --git a/completions/curl b/completions/curl
new file mode 100644
index 0000000..1fb96d6
--- /dev/null
+++ b/completions/curl
@@ -0,0 +1,91 @@
+have curl || return
+
+_curl()
+{
+    local cur prev words cword
+    _init_completion || return
+
+    case $prev in
+        --ciphers|--connect-timeout|-C|--continue-at|--form|--form-string|\
+        --ftp-account|--ftp-alternative-to-user|-P|--ftp-port|-H|--header|-h|\
+        --help|--hostpubmd5|--keepalive-time|--krb|--limit-rate|--local-port|\
+        --mail-from|--mail-rcpt|--max-filesize|--max-redirs|-m|--max-time|\
+        --pass|--proto|--proto-redir|--proxy-user|--proxy1.0|-Q|--quote|-r|\
+        --range|-X|--request|--retry|--retry-delay|--retry-max-time|\
+        --socks5-gssapi-service|-t|--telnet-option|--tftp-blksize|-z|\
+        --time-cond|--url|-u|--user|-A|--user-agent|-V|--version|-w|--write-out)
+            return
+            ;;
+        -K|--config|-b|--cookie|-c|--cookie-jar|-D|--dump-header|--egd-file|\
+        --key|--libcurl|-o|--output|--random-file|-T|--upload-file)
+            _filedir
+            return
+            ;;
+        --cacert|-E|--cert)
+            _filedir '@(c?(e)rt|cer|pem|der)'
+            return
+            ;;
+        --capath)
+            _filedir -d
+            return
+            ;;
+        --cert-type|--key-type)
+            COMPREPLY=( $( compgen -W 'DER PEM ENG' -- "$cur" ) )
+            return
+            ;;
+        --crlfile)
+            _filedir crl
+            return
+            ;;
+        -d|--data|--data-ascii|--data-binary|--data-urlencode)
+            if [[ $cur == \@* ]]; then
+                cur=${cur:1}
+                _filedir
+                COMPREPLY=( "${COMPREPLY[@]/#/@}" )
+            fi
+            return
+            ;;
+        --engine)
+            COMPREPLY=( $( compgen -W 'list' -- "$cur" ) )
+            return
+            ;;
+        --ftp-method)
+            COMPREPLY=( $( compgen -W 'multicwd nocwd singlecwd' -- "$cur" ) )
+            return
+            ;;
+        --ftp-ssl-ccc-mode)
+            COMPREPLY=( $( compgen -W 'active passive' -- "$cur" ) )
+            return
+            ;;
+        --interface)
+            _available_interfaces -a
+            return
+            ;;
+        -x|--proxy|--socks4|--socks4a|--socks5|--socks5-hostname)
+            _known_hosts_real
+            return
+            ;;
+        --pubkey)
+            _filedir pub
+            return
+            ;;
+        --stderr)
+            COMPREPLY=( $( compgen -W '-' -- "$cur" ) )
+            _filedir
+            return
+            ;;
+    esac
+
+    if [[ $cur == -* ]]; then
+        COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+    fi
+} &&
+complete -F _curl curl
+
+# 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/curl.exp b/test/completion/curl.exp
new file mode 100644
index 0000000..e8bf213
--- /dev/null
+++ b/test/completion/curl.exp
@@ -0,0 +1 @@
+assert_source_completions curl
diff --git a/test/lib/completions/a2ps.exp b/test/lib/completions/curl.exp
similarity index 80%
copy from test/lib/completions/a2ps.exp
copy to test/lib/completions/curl.exp
index 77cd07f..53512bc 100644
--- a/test/lib/completions/a2ps.exp
+++ b/test/lib/completions/curl.exp
@@ -11,7 +11,7 @@ proc teardown {} {
 setup
 
 
-assert_complete_any "a2ps "
+assert_complete_any "curl -"
 
 
 sync_after_int

-- 
bash-completion



More information about the Bash-completion-commits mailing list