diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2008-10-30 10:10:59 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2008-10-30 10:10:59 +0000 |
commit | 24dc4bec073250312b17d62571f165766a430690 (patch) | |
tree | d736241220c59d1358f6e2ce2fda48543cf42ef6 | |
parent | 5c0b3ddc4251965559cb606f3441c240e0ea7936 (diff) | |
download | zsh-24dc4bec073250312b17d62571f165766a430690.tar.gz zsh-24dc4bec073250312b17d62571f165766a430690.tar.xz zsh-24dc4bec073250312b17d62571f165766a430690.zip |
unposted: add _tcpsys
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | Completion/Zsh/Command/_tcpsys | 49 |
2 files changed, 53 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog index 582b65c76..0affdadfe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2008-10-30 Peter Stephenson <pws@csr.com> + * unposted: Completion/Zsh/Command/_tcpsys: added this since + it's already in .distfiles. It's very limited in what it + does but it's better than nothing, I suppose. + * 25950: configure.ac: need "x$dynamic" trick in two more places. diff --git a/Completion/Zsh/Command/_tcpsys b/Completion/Zsh/Command/_tcpsys new file mode 100644 index 000000000..dcc6f6cc8 --- /dev/null +++ b/Completion/Zsh/Command/_tcpsys @@ -0,0 +1,49 @@ +#compdef tcp_open + +local context line expl nm=$compstate[nmatches] +local -a state argargs sesslist +local -A opt_args + +case $service in + (tcp_open) + argargs=( + '(-a -f -l)-s[open session(s)]' + '(-a -f -s)-l[open list of sessions]' + '(-f -s -l)-a[open session for accept on fd]:fd:->fd' + '(-a -s -l)-f[open session for accept on fd]:fd:->fd' + '-q[quiet mode]' + '-z[no zle handler]' + ) + if [[ -n $words[(R)-(a|f)*] ]]; then + argargs+=(':session:->session') + elif [[ -n $words[(R)-(l|s)*] ]]; then + argargs+=('*:session:->session') + else + argargs+=(':host:->host' ':port:->port' '*:session:->session') + fi + _arguments -C $argargs + ;; +esac + +while (( $#state )); do + case "$state[1]" in + (host) + _hosts + ;; + + (port) + _ports + ;; + + (sessionlist) + compset -P '*,' + ;& + + (session) + sesslist=(${${${(f)"$(<~/.ztcp_sessions)"}:#[[:space:]]#\#*}/ /:}) + _describe -t sessions 'TCP session' sesslist && return + ;; + + esac + shift state +done |