diff options
author | David Paleino <dapal@debian.org> | 2011-11-03 12:32:52 +0100 |
---|---|---|
committer | David Paleino <dapal@debian.org> | 2011-11-03 12:32:52 +0100 |
commit | 2c8171c38d87ddef31c92a76547d3fdf773a1337 (patch) | |
tree | 5e720d5a06ead72ed55454bf6647a712a761ed91 /completions/sitecopy | |
parent | 9920a8faedf704420571d8072ccab27e9dac40ba (diff) | |
download | bash-completion-2c8171c38d87ddef31c92a76547d3fdf773a1337.tar.gz |
Imported Upstream version 1.90upstream/1.90
Diffstat (limited to 'completions/sitecopy')
-rw-r--r-- | completions/sitecopy | 55 |
1 files changed, 33 insertions, 22 deletions
diff --git a/completions/sitecopy b/completions/sitecopy index 616bc5e4..1f18514a 100644 --- a/completions/sitecopy +++ b/completions/sitecopy @@ -1,40 +1,51 @@ -# sitecopy(1) completion +# sitecopy(1) completion -*- shell-script -*- # Copyright 2003 Eelco Lempsink <eelcolempsink@gmx.net> +# 2011 Raphaƫl Droz <raphael.droz+floss@gmail.com> # License: GNU GPL v2 or later -have sitecopy && _sitecopy() { - local cur + local cur prev words cword split + _init_completion -s || return - COMPREPLY=() - _get_comp_words_by_ref cur + case $prev in + --debug|-d) + COMPREPLY=( $( compgen -W "socket files rcfile ftp http httpbody + rsh sftp xml xmlparse cleartext" -- "$cur" ) ) + compopt -o nospace + return 0 + ;; + --logfile|-g|--rcfile|-r) + _filedir + return 0 + ;; + --storepath|-p) + _filedir -d + return 0 + ;; + esac case $cur in --*) - COMPREPLY=( $( compgen -W "$(sitecopy -h | command grep -e '--\w' |\ - awk '{sub (/=(FILE|PATH)/, "", $2); print $2}')" -- "$cur" ) ) - ;; - -*) - COMPREPLY=( $( compgen -W "$(sitecopy -h | command grep -e '-\w' | \ - awk '{sub (",", "", $1); print $1}')" -- "$cur" ) ) + COMPREPLY=( $( compgen -W "$(_parse_help $1)" -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace + return 0 ;; - *) - if [ -r ~/.sitecopyrc ]; then - COMPREPLY=( $( compgen -W "$(command grep '^["$'\t '"]*site' \ - ~/.sitecopyrc | awk '{print $2}')" -- "$cur" ) ) - fi + + # only complete long options + -) + compopt -o nospace + COMPREPLY=( -- ) + return 0 ;; esac + if [ -r ~/.sitecopyrc ]; then + COMPREPLY=( $( compgen -W "$($1 -v | \ + command sed -n '/^Site:/s/Site: //p')" -- "$cur" ) ) + fi return 0 } && complete -F _sitecopy -o default sitecopy -# 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 |