Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: more completion stuff
- X-seq: zsh-workers 7722
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: PATCH: more completion stuff
- Date: Wed, 8 Sep 1999 16:18:25 +0200 (MET DST)
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
Here is an improved `_dvi', a new `_yodl', a new `_ssh', and some more
magic for `_yp'.
Bye
Sven
diff -u -r oldcompletion/User/_dvi Completion/User/_dvi
--- oldcompletion/User/_dvi Wed Sep 8 09:03:56 1999
+++ Completion/User/_dvi Wed Sep 8 14:54:23 1999
@@ -1,3 +1,95 @@
#compdef dvips dvibook dviconcat dvicopy dvidvi dviselect dvitodvi dvitype
-_files -g '*.(dvi|DVI)'
+local expl args
+
+args=(
+ '-i[specify input file]:input DVI file:_files -g \*.\(dvi\|DVI\)' \
+ '-o[specify output file]:output DVI file:_files -g \*.\(dvi\|DVI\)' \
+ ':input DVI file:_files -g \*.\(dvi\|DVI\)' \
+ ':output DVI file:_files -g \*.\(dvi\|DVI\)'
+)
+
+case "$words[1]" in
+dvips)
+ _arguments -s \
+ '-a[make three passes]' \
+ '(-B)-A[print only odd numbered pages]' \
+ '(-A)-B[print only even numbered pages]' \
+ '(-c -C)-b[select number of copies (duplicating body)]:number of copies:' \
+ '(-b -C)-c[select number of copies]:number of copies:' \
+ '(-b -c)-C[select number of copies (collated)]:number of copies:' \
+ '-d[set debug flags]:debug flags:' \
+ '(-X -Y)-D[set resolution]:resolution in dots per inch:' \
+ '-e[set maximum character offset]:maximum character offset:' \
+ '-E[generate EPSF file]' \
+ '(: -o)-f[read from stdin, write to stdout]' \
+ '-F[append control-D]' \
+ '-h[specify additional header file]:postscript header file:_files -g \*.\(\#i\)\(ps\|eps\)' \
+ '-i[one file per section]' \
+ '-k[print crop marks]' \
+ '-K[include postscript comments]' \
+ '(-pp)-l[specify last page to print]:number of last page:' \
+ '-m[specify manual feed for printer]' \
+ '-M[no automatic font generation]' \
+ '(-pp)-n[specify maximum number of pages to print]:maximum number of pages:' \
+ '-N[turn off structured comments]' \
+ '(-f)-o[specify output file name]:output file name:_files -g \*.\(\#i\)\(ps\|eps\)' \
+ '-O[specify offset of origin]:offset of origin (<x>,<y>):' \
+ '(-p -l -n)-pp[specify which pages to print]:list of pages or ranges to print:' \
+ '(-pp)-p[specify first page to print]:number of first page:' \
+ '-P[specify printer]:printer name:' \
+ '-q[quiet operation]' \
+ '-r[reverse order of pages]' \
+ '-s[enclose output in save/restore pair]' \
+ '-S[set maximum number of pages per section]:maximum number of pages per section:' \
+ '(-T)*-t[specify paper type]:paper type:(letter legal ledger a4 a3 landscape)' \
+ '(-t)-T[set paper size]:paper size (<x>,<y>):' \
+ '-x[set magnification ratio]:magnification ratio (per mille):' \
+ '(-D)-X[set horizontal resolution]:horizontal resolution:' \
+ '(-D)-Y[set vertical resolution]:vertical resolution:' \
+ '-Z[compress bitmapped fonts]' \
+ ':input file:_files -g \*.\(dvi\|DVI\)'
+ ;;
+dvibook)
+ _arguments -s \
+ '-q[quiet operation]' \
+ '-s-[specify signature size]:signature size:' \
+ "$args[@]"
+ ;;
+dviconcat)
+ _arguments \
+ '-m[specify magnification]:magnification factor:' \
+ '-o[specify output file]:output DVI file:_files -g \*.\(dvi\|DVI\)' \
+ '*:input DVI file:_files -g \*.\(dvi\|DVI\)'
+ ;;
+dvidvi)
+ _arguments -s \
+ '-q[quiet operation]' \
+ '-r[reverse order of pages]' \
+ '(-i -x)-f[select first page]:number of first page:' \
+ '(-i -x)-l[select last page]:number of last page:' \
+ '(-i -x)-n[select number of pages]:maximum number of pages:' \
+ '(-f -l -n)-i[specify included pages]:list of included pages:' \
+ '(-f -l -n)-x[specify excluded pages]:list of excluded pages:' \
+ ':input DVI file:_files -g \*.\(dvi\|DVI\)' \
+ ':output DVI file:_files -g \*.\(dvi\|DVI\)'
+ ;;
+dviselect)
+ _arguments -s \
+ '-s[silent operation]' \
+ ':list of pages:' \
+ "$args[@]"
+ ;;
+dvitodvi)
+ _arguments -s \
+ '-q[quiet operation]' \
+ '-w-[set w dimension specifier]:width for dimension specifier:' \
+ '-h-[set h dimension specifier]:height for dimension specifier:' \
+ ':page specifications:' \
+ "$args[@]"
+ ;;
+*)
+ _description expl 'DVI file'
+ _files "$expl[@]" -g '*.(dvi|DVI)'
+ ;;
+esac
diff -u -r oldcompletion/User/_rlogin Completion/User/_rlogin
--- oldcompletion/User/_rlogin Wed Sep 8 09:03:58 1999
+++ Completion/User/_rlogin Wed Sep 8 15:37:39 1999
@@ -1,4 +1,4 @@
-#compdef rlogin rsh ssh
+#compdef rlogin rsh
local expl
diff -u -r oldcompletion/User/_ssh Completion/User/_ssh
--- oldcompletion/User/_ssh Wed Sep 8 15:36:18 1999
+++ Completion/User/_ssh Wed Sep 8 16:15:43 1999
@@ -0,0 +1,152 @@
+#compdef ssh ssh-add ssh-agent ssh-keygen
+
+local state lstate line ret=1 expl
+typeset -A options
+
+case "$words[1]" in
+ssh)
+ _arguments -s \
+ '-a[disable forwarding of authentication agent connection]' \
+ '-c[select encryption cipher]:encryption cipher:(idea des 3des blowfish arcfour tss none)' \
+ '-e[set escape character]:escape character (or `none'"'"'):' \
+ '(-n)-f[go to background]' \
+ '-i[select identity file]:SSH identity file:_files' \
+ '-k[disable forwarding of kerberos tickets]' \
+ '-l[specify login name]:login name:_users' \
+ '-n[redirect stdin from /dev/null]' \
+ '*-o[specify extra options]:option string:->option' \
+ '-p[specify port on remote host]:port number on remote host:' \
+ '-q[quiet operation]' \
+ '-P[use non priviledged port]' \
+ '-t[force pseudo-tty allocation]' \
+ '-v[verbose mode]' \
+ '-V[show version number]' \
+ '-x[disable X11 forwarding]' \
+ '-C[compress all data]' \
+ '-L[specify local port forwarding]:local port forwarding:->forward' \
+ '-R[specify remote port forwarding]:remote port forwarding:->forward' \
+ ':remote host name:_hosts' \
+ ':command: _command_names -e' \
+ '*::args:->command' && ret=0
+
+ while [[ -n "$state" ]]; do
+ lstate="$state"
+ state=''
+
+ case "$lstate" in
+ option)
+ if compset -P '* '; then
+ case "$IPREFIX" in
+ *(#i)(batchmode|compression|fallbacktorsh|forward(agent|x11)|keepalive|passwordauthentication|rhosts(|rsa)authentication|rsaauthentication|usersh|kerberos(authetication|tgtparsing)|usepriviledgedport)*)
+ compadd yes no && ret=0
+ ;;
+ *(#i)cipher*)
+ _description expl 'encryption cipher'
+ compadd "$expl[@]" idea des 3des blowfish arcfour tss none && ret=0
+ ;;
+ *(#i)globalknownhostsfile*)
+ _description expl 'global file with known hosts'
+ _files "$expl[@]" && ret=0
+ ;;
+ *(#i)hostname*)
+ _description expl 'real host name to log into'
+ _hosts "$expl[@]" && ret=0
+ ;;
+ *(#i)identityfile*)
+ _description expl 'SSH identity file'
+ _files "$expl[@]" && ret=0
+ ;;
+ *(#i)(local|remote)forward*)
+ state=forward
+ ;;
+ *(#i)proxycommand*)
+ compset -q
+ shift 1 words
+ (( CURRENT-- ))
+ _normal && ret=0
+ ;;
+ *(#i)stricthostkeychecking*)
+ compadd yes no ask
+ ;;
+ *(#i)userknownhostsfile*)
+ _description expl 'user file with known hosts'
+ _files "$expl[@]" && ret=0
+ ;;
+ *(#i)user*)
+ _description expl 'user to log in as'
+ _users "$expl[@]" && ret=0
+ ;;
+ *(#i)xauthlocation*)
+ _description expl 'xauth program'
+ _files "$expl[@]" -g '*(*)' && ret=0
+ ;;
+ esac
+ else
+ _description expl 'configure file option'
+ compadd "$expl[@]" -M 'm:{a-z}={A-Z}' -S ' ' - \
+ BatchMode ClearAllForwardings Cipher Compression CompressionLevel \
+ Host ConnectionAttempts EscapeChar FallBackToRsh ForwardAgent \
+ ForwardX11 GlobalKnownHostsFile HostName IdentityFile KeepAlive \
+ KerberosAuthentication KerberosTgtPassing LocalForward \
+ NumberOfPasswordPrompts PasswordAuthentication Port ProxyCommand \
+ RemoteForward RhostsAuthentication RhostsRSAAuthentication \
+ RSAAuthentication StrictHostKeyChecking TISAuthentication \
+ UsePriviledgedPort User UserKnownHostsFile UseRsh \
+ XAuthLocation && ret=0
+ fi
+ ;;
+ forward)
+ if compset -P 1 '*:'; then
+ if compset -P '*:'; then
+ _message 'port number'
+ else
+ _hosts -S:
+ fi
+ else
+ _message 'listen-port number'
+ fi
+ return
+ ;;
+ command)
+ shift 1 words
+ (( CURRENT-- ))
+ _normal
+ return
+ ;;
+ esac
+
+ break;
+ done
+
+ return ret
+ ;;
+ssh-add)
+ _arguments -s \
+ '-p[read passphrase from stdin]' \
+ '-l[list all identities]' \
+ '-d[remove identity]' \
+ '-D[delete all identities]' \
+ '*:SSH identity file:_files'
+ return
+ ;;
+ssh-agent)
+ _arguments -s \
+ '(:)-k[kill agent automatically]' \
+ '(:)-s[force sh-style shell]' \
+ '(:)-c[force csh-style shell]' \
+ '*::command: _normal'
+ return
+ ;;
+ssh-keygen)
+ _arguments \
+ '(-p -c -u -P)-b[specify number of bits in key]:bits in key:' \
+ '(-p -c)-f[key file]:key file:_files' \
+ '(-c -u)-N[specify new passphrase]:new passphrase:' \
+ '(-b -u -f)-P[specify old passphrase]:old passphrase:' \
+ '(-p -u)-C[specify new comment]:new comment:' \
+ '(-b -f -C -u -c)-p[change passphrase of private key file]' \
+ '(-b -f -N -p -u)-c[change comment in private and public key files]' \
+ '(-b -N -C -p -c)-u[change key cipher to default]'
+ return
+ ;;
+esac
diff -u -r oldcompletion/User/_yodl Completion/User/_yodl
--- oldcompletion/User/_yodl Wed Sep 8 14:00:15 1999
+++ Completion/User/_yodl Wed Sep 8 13:59:37 1999
@@ -0,0 +1,14 @@
+#compdef -P yodl(|2*)
+
+_arguments -s \
+ '-D-[define symbol]:define symbol:' \
+ '-I-[set include directory]:include directory:_files -/' \
+ '-l-[set live data policy]:live data policy:((0\:suppress\ SYSTEM\ and\ PIPETHROUGH 1\:require\ user\ confirmation 2\:display\ macros 3\:no\ confirmation,\ no\ display))' \
+ '-o-[specify output file]:output file:_files' \
+ '-P-[specify preload command]:preload command:' \
+ '-p-[specify maximum number of passes]:maximum number of passes:' \
+ '-t[enable tracing mode]' \
+ '-v[enable verbose mode]' \
+ '-w[enable warnings]' \
+ '-h[show usage information]' \
+ '*:YODL input file:_files -g \*.\(\#i\)yodl'
diff -u -r oldcompletion/User/_yp Completion/User/_yp
--- oldcompletion/User/_yp Wed Sep 8 09:03:59 1999
+++ Completion/User/_yp Wed Sep 8 13:48:31 1999
@@ -88,7 +88,11 @@
local expl
_description expl 'map name'
- compadd "$expl[@]" - "$_yp_cache_maps[@]" && ret=0
+
+ # The `-M ...' allows `pa.n<TAB>' to complete to `passwd.byname'.
+
+ compadd "$expl[@]" -M 'l:.|by=by l:.|=by r:|.=* r:|=*' - \
+ "$_yp_cache_maps[@]" && ret=0
if [[ $+options[-t] -eq 0 && "$state" != maponly ]]; then
_description expl 'nicknames'
compadd "$expl[@]" - "$_yp_cache_nicks[@]" && ret=0
--
Sven Wischnowsky wischnow@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author