1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-12-29 16:25:35 +01:00

gi1242+zsh@gmail.com: 28594:

Various new and improved completions
This commit is contained in:
Peter Stephenson 2011-01-09 16:57:01 +00:00
parent a89f0559c2
commit e72999c092
19 changed files with 638 additions and 75 deletions

View file

@ -1,3 +1,19 @@
2011-01-09 Peter Stephenson <p.w.stephenson@ntlworld.com>
* gi1242+zsh@gmail.com: 28594 (with changes as in 28598):
Completion/Linux/Command/.distfiles,
Completion/Linux/Command/_modutils,
Completion/Linux/Command/_wpa_cli,
Completion/Unix/Command/.distfiles, Completion/Unix/Command/_lp,
Completion/Unix/Command/_pgrep,
Completion/Unix/Command/_subversion,
Completion/Unix/Command/_unison,
Completion/Unix/Command/_xournal, Completion/Unix/Type/_pdf,
Completion/X/Command/.distfiles, Completion/X/Command/_gv,
Completion/X/Command/_okular, Completion/X/Command/_pdftk,
Completion/X/Command/_vnc, Completion/X/Command/_xrandr: Various
new and improved completions.
2011-01-07 Peter Stephenson <pws@csr.com>
* 28590 (added a comment): Src/builtin.c, Test/B04read.ztst:
@ -14069,5 +14085,5 @@
*****************************************************
* This is used by the shell to define $ZSH_PATCHLEVEL
* $Revision: 1.5175 $
* $Revision: 1.5176 $
*****************************************************

View file

@ -27,5 +27,6 @@ _tune2fs
_uml
_valgrind
_vserver
_wpa_cli
_yast
'

View file

@ -1,8 +1,23 @@
#compdef lsmod modinfo modprobe rmmod insmod
_modules_caching_policy()
{
# Rebuild every week, or if $modules_dir is newer than the cache
local -a oldp
oldp=( "$1"(Nmw+1) )
(( $#oldp )) || [[ $modules_dir -nt $1 ]]
}
local curcontext="$curcontext" expl state line modules ign args ret=1
local -r modules_dir=/lib/modules
local update_policy
zstyle -s ":completion:*:*:$service:*" cache-policy update_policy
if [[ -z "$update_policy" ]]; then
zstyle ":completion:*:*:$service:*" cache-policy _modules_caching_policy
fi
args=(
'(-)'{-V,--version}'[print version]'
'(-)'{-h,--help}'[print help text]'
@ -39,6 +54,7 @@ case "$service" in
"(-v --verbose $ign)"{-v,--verbose}'[print all commands as executed]' \
'(-C --config)'{-C,--config}'[specify config file]:config file:_files' \
"(-r --remove -l --list -t --type -a --all $ign)"{-r,--remove}'[remove module (stacks)]' \
"(-l --list -t --type -a --all $ign)"{'-i[ignore install/remove commands in config file]','--ignore-install[ignore install commands in config file]','--ignore-remove[ignore remove commands in config file]'} \
"(* -l --list -r --remove $ign)"{-l,--list}'[list matching modules]' \
"(-c $ign)1:modules:->loadable_modules" \
"(-c -l --list -t --type $ign)*:params:->params" && ret=0
@ -87,7 +103,13 @@ case "$state" in
else
kver=$(uname -r)
fi
modules=( $modules_dir/$kver/(*~(source|build))/**/*(.:t:r) )
if [[ -z $modules ]] && ! _cache_invalid modules-$kver && \
! _retrieve_cache modules-$kver;
then
# 2011-01-02 gi1242: Do we need .o files? Or is .ko enough?
modules=( $modules_dir/$kver/(*~(source|build))/**/*.(o|ko)(.:t:r) )
_store_cache modules-$kver modules
fi
if [[ $state = loadable_modules ]]; then
modules=( ${modules:#(${(j:|:)~${=loaded_modules//_/-}})} )

View file

@ -0,0 +1,13 @@
#compdef wpa_cli
_arguments \
'-p:path to ctrl sockets:_files -g "*(=)"' \
'-i:ifname:_net_interfaces' \
'-h[help]' \
'-v[shown version information]' \
'-B[run a daemon in the background]' \
'-a[run in daemon mode]:action file:_files' \
'-P:pid file:_files' \
'-g:global ctrl:_files -g "*(=)"' \
'-G:ping interval:' \
':command:(status ping mib help interface level license quit set logon logoff pmksa reassociate preauthenticate identity password new_password pin otp passphrase bssid list_networks select_network enable_network disable_network add_network remove_network set_network get_network save_config disconnect reconnect scan scan_results bss get_capability reconfigure terminate interface_add interface_remove interface_list ap_scan stkstart ft_ds wps_pbc wps_pin wps_reg)'

View file

@ -146,6 +146,7 @@ _pbm
_perforce
_perl
_perldoc
_pgrep
_php
_pine
_ping
@ -222,6 +223,7 @@ _unace
_uname
_unexpand
_uniq
_unison
_units
_user_admin
_uzbl
@ -238,6 +240,7 @@ _wiggle
_xargs
_xmlsoft
_xmms2
_xournal
_yafc
_yodl
_yp

View file

@ -1,52 +1,219 @@
#compdef lp lpr lpq lprm
#compdef lp lpr lpq lprm lpoptions lpstat
local expl ret=1 printer list disp strs shown
if compset -P '-[dP]' || [[ "$words[CURRENT-1]" = -[dP] ]]; then
_printers
else
if [[ "$service" = (lpq|lprm) ]]; then
if [[ "$words" = *-P* ]]; then
printer=(-P "${${words##*-P( |)}%% *}")
else
printer=()
fi
list=( ${(M)"${(f@)$(_call_program jobs lpq $printer 2> /dev/null)}":#[0-9]*} )
_lp_get_printer()
{
# No reason to call _lp_get_printer when service == lpstat. Others matched
# below.
case $service in
(lpr|lpq|lprm)
[[ "$words" == (#I)*-P* ]] && printer="${${words##*(#I)-P( |)}%% *}"
;;
(lp)
[[ "$words" == (#I)*-d* ]] && printer="${${words##*(#I)-d( |)}%% *}"
;;
(lpoptions)
[[ "$words" == (#I)*-(d|p)* ]] && \
printer="${${words##*(#I)-(d|p)( |)}%% *}"
;;
esac
}
if (( $#list )); then
_tags users jobs
_lp_job_options()
{
local -a lopts_with_args lopts_no_args
while _tags; do
if _requested users; then
strs=( "${(@)${(@)list##[^ ]##[ ]##[^ ]##[ ]##}%%[ ]*}" )
if [[ -z "$shown" ]] &&
zstyle -T ":completion:${curcontext}:users" verbose; then
disp=(-ld list)
shown=yes
else
disp=()
fi
_all_labels users expl user compadd "$disp[@]" -a strs ||
_users && ret=0
fi
if _requested jobs; then
strs=( "${(@)${(@)list##[^ ]##[ ]##[^ ]##[ ]##[^ ]##[ ]##}%%[ ]*}" )
if [[ -z "$shown" ]] &&
zstyle -T ":completion:${curcontext}:jobs" verbose; then
disp=(-ld list)
shown=yes
else
disp=()
fi
_all_labels jobs expl job compadd "$disp[@]" -a strs && ret=0
fi
(( ret )) || return 0
done
else
_message 'no print jobs'
fi
return 1
# Generic options (from lp manual page)
lopts_with_args=( media orientation-requested sides number-up scaling cpi lpi
page-{bottom,left,right,top} )
lopts_no_args=(fitplot landscape)
_lp_get_printer
[[ -n "$printer" ]] && printer=(-p $printer)
# The program specified by the style list-printer-options should list jobs in
# the same style as lpoptions -l.
if compset -P '*='; then
# List values for the option
case ${IPREFIX%=} in
(media)
compadd "$@" a4 letter legal
;;
(orientation-requested)
compadd "$@" 4
;;
(sides)
compadd "$@" one-sided two-sided-{long,short}-edge
;;
(number-up)
_description -V option-o-1 expl "pages per sheet"
compadd "$expl[@]" 2 4 6 9 16
;;
(scaling|cpi|lpi|page-(bottom|left|right|top))
return 0; # Don't complete anything
;;
(*)
compadd "$@" \
$(_call_program list-printer-options lpoptions $printer -l | \
grep "^${IPREFIX%=}" | cut -d: -f2 | tr -d \* )
;;
esac
else
_pspdf
# List options
local eq_suffix
# Don't add an '=' suffix when completing lpoptions -r
if [[ $service == lpoptions && $words[CURRENT-1] == "-r" ]]; then
eq_suffix=()
else
eq_suffix=(-S '=')
fi
_description lpopts expl "generic printer options"
compadd "$expl[@]" $eq_suffix $lopts_with_args
compadd "$expl[@]" $lopts_no_args
_description printeropts expl "printer specific options"
compadd "$expl[@]" $eq_suffix \
$(_call_program list-printer-options \
lpoptions $printer -l | cut -d/ -f1)
fi
fi
}
_lp_list_jobs()
{
_lp_get_printer
[[ -n "$printer" ]] && printer=(-P $printer)
list=( ${(M)"${(f@)$(_call_program jobs lpq $printer 2> /dev/null)}":#[0-9]*} )
if (( $#list )); then
_tags users jobs
while _tags; do
if _requested users; then
strs=( "${(@)${(@)list##[^ ]##[ ]##[^ ]##[ ]##}%%[ ]*}" )
if [[ -z "$shown" ]] &&
zstyle -T ":completion:${curcontext}:users" verbose;
then
disp=(-ld list)
shown=yes
else
disp=()
fi
_all_labels users expl user compadd "$disp[@]" -a strs ||
_users && ret=0
fi
if _requested jobs; then
strs=( "${(@)${(@)list##[^ ]##[ ]##[^ ]##[ ]##[^ ]##[ ]##}%%[ ]*}" )
if [[ -z "$shown" ]] &&
zstyle -T ":completion:${curcontext}:jobs" verbose; then
disp=(-ld list)
shown=yes
else
disp=()
fi
_all_labels jobs expl job compadd "$disp[@]" -a strs && ret=0
fi
(( ret )) || return 0
done
else
_message 'no print jobs'
fi
return 1
}
case $service in
(lpq)
_arguments \
'-E[Force encryption]' \
'-U:username (for connection to server):_users' \
'-h:alternate server:_hosts' \
'(-a)-P+[destination printer]:printers:_printers' \
'(-P)-a[all printers]' \
'-l[long listing]' \
'*:poll interval (+seconds):'
;;
(lprm)
_arguments \
'-E[Force encryption]' \
'-U:username (for connection to server):_users' \
'-h:alternate server:_hosts' \
'-P+[destination printer]:printers:_printers' \
'*:job ids:_lp_list_jobs'
;;
(lpoptions)
_arguments \
'-E[Force encryption]' \
'-U:username (for connection to server):_users' \
'-h:alternate server:_hosts' \
'(-p -l -r -x)-d[set default printer]:printers:_printers' \
'(-l -x)*-o:job options:_lp_job_options' \
'(-d -x)-p[destination printer for options]:printers:_printers' \
'(-d -o -r -x)-l[list options]' \
'(-d -l -x)*-r:remove option:_lp_job_options' \
'(-d -l -r -o)-x[remove all options]:printers:_printers'
;;
(lpstat)
_arguments \
'-E[Force encryption]' \
'-R[Shows print job ranking]' \
'-U:username (for connection to server):_users' \
'-W:which jobs:(completed not-completed)' \
'-a[Show accepting state]:printers:_printers' \
'-c:printer classes:' \
'-d[Show current default destination]' \
'-h:hostname (alternate server):_hosts' \
'-l[long listing]' \
'-o[destinations]:printers:_printers' \
'-p:printers:_printers' \
'-r[CUPS server running status]' \
'-s[Status summary]' \
'-t[All status info]' \
'-u[list jobs by users]:users:_users' \
'-v[show devices]:printers:_printers'
;;
(lpr)
_arguments \
'-E[Force encryption]' \
'-H:hostname (alternate server):_hosts' \
'(-C -J -T)'-{C,J,T}':job name:' \
'-P+[destination printer]:printers:_printers' \
'-U:username (for connection to server):_users' \
'-#[Copies]:copies (1--100):' \
'-h[Disables banner printing]' \
'-l[raw file]' \
'-m[Send an email on job completion]' \
'*-o:print job options:_lp_job_options' \
'-p[format with shaded header incl. date, time etc.]' \
'-q[Hold job for printing.]' \
'-r[delete files after printing]' \
'*:PS/PDF files:_pspdf'
;;
(lp)
_arguments \
'-E[Force encryption]' \
'-U[username (for connection to server)]:username:_users' \
'-c[(OBSOLETE) copy to spool dir before printing]' \
'-d[destination printer]:printers:_printers' \
'-h:hostname (alternate server):_hosts' \
'-i[job id to modify]:job id:' \
'-m[Send an email on job completion]' \
'-n[Copies]:copies (1--100):' \
'*-o:print job options:_lp_job_options' \
'-q[Job priority -- 1 (lowest) to 100 (highest)]:priority:' \
'-s[Dont report resulting job IDs]' \
'-t[Sets the job name]:job name:' \
'-u[job submission username]:username:_users' \
'-H[Time to print]:print time (or enter hh\:mm):(hold immediate restart resume)' \
'-P:page range list:' \
'*:PS/PDF files:_pspdf'
;;
esac

View file

@ -0,0 +1,112 @@
#compdef pgrep pkill
local context state line
typeset -A opt_args
typeset -a arguments
arguments=('-P[parent process id]:parent process id:->ppid'
'-g[match only in process group ids]:group:->pgid'
'-G[match only real group id]:group:->group'
'-s[match only session id]:session id:->sid'
'-t[match only controlled by terminal]:terminal device:->tty'
'-u[match only effective user id]:user:->user'
'-U[match only real user id]:user:->user'
'(-n)-o[oldest process]'
'(-o)-n[newest process]'
'-f[match against full command line]'
'-v[negate matching]'
'-x[match exactly]'
'*:process name:->pname')
if [[ $service == 'pkill' ]]
then
arguments+=('-'${^signals}'[signal]')
elif [[ $service == 'pgrep' ]]
then
arguments+=('-d[output delimiter]:delimiter:compadd ${(s\:\:)IFS}'
'-l[list name in addition to id]')
fi
_arguments -s -w $arguments
case $state in
(tty)
compset -P '*,'
local -a used
used=(${(s:,:)IPREFIX})
compadd -S ',' -q -F used /dev/tty*(:t)
;;
(sid)
compset -P '*,'
local -a used sid
used=(${(s:,:)IPREFIX})
sid=(${(uon)$(ps -A o sid=)})
compadd -S ',' -q -F used $sid
;;
(ppid)
compset -P '*,'
local -a used ppid
used=(${(s:,:)IPREFIX})
ppid=(${(uon)$(ps -A o ppid=)})
compadd -S ',' -q -F used $ppid
;;
(pgid)
compset -P '*,'
local -a used pgid
used=(${(s:,:)IPREFIX})
pgid=(${(uon)$(ps -A o pgid=)})
compadd -S ',' -q -F used $pgid
;;
(pname)
if (( ${+opt_args[-x]} )) && (( ${+opt_args[-f]} ))
then
compadd ${(u)${(f)"$(ps -A o cmd=)"}}
else
compadd ${(u)${(f)"$(ps -A co cmd=)"}}
fi
;;
(group)
compset -P '*,'
local group
group=$(getent group)
local -a groups ids
groups=(${${(f)group}%%:*})
ids=(${${${(f)group}#*:*:}%%:*})
local -a used
used=(${(s:,:)IPREFIX})
compadd -S ',' -q -F used -d ids $groups $groups
;;
(user)
compset -P '*,'
local passwd
passwd=$(getent passwd)
local -a users ids
users=(${${(f)passwd}%%:*})
ids=(${${${(f)passwd}#*:*:}%%:*})
local -a used
used=(${(s:,:)IPREFIX})
compadd -S ',' -q -F used -d ids $users $users
;;
esac

View file

@ -4,6 +4,12 @@ _svn () {
local curcontext="$curcontext" state line expl ret=1
typeset -A opt_args
local update_policy
zstyle -s ":completion:*:*:$service:*" cache-policy update_policy
if [[ -z "$update_policy" ]]; then
zstyle ":completion:*:*:$service:*" cache-policy _svn_caching_policy
fi
_arguments -C \
'(-)--help[print help information]' \
'(- *)--version[print client version information]' \
@ -12,9 +18,12 @@ _svn () {
if [[ -n $state ]] && (( ! $+_svn_cmds )); then
typeset -gHA _svn_cmds
_svn_cmds=(
${=${(f)${${"$(LC_ALL=C _call_program commands svn help)"#l#*Available subcommands:}%%Subversion is a tool*}}/(#s)[[:space:]]#(#b)([a-z]##)[[:space:]]#(\([a-z, ?]##\))#/$match[1] :$match[1]${match[2]:+:${${match[2]//[(),]}// /:}}:}
)
if ! _cache_invalid svn_cmds && ! _retrieve_cache svn_cmds; then
_svn_cmds=(
${=${(f)${${"$(LC_ALL=C _call_program commands svn help)"#l#*Available subcommands:}%%Subversion is a tool*}}/(#s)[[:space:]]#(#b)([a-z]##)[[:space:]]#(\([a-z, ?]##\))#/$match[1] :$match[1]${match[2]:+:${${match[2]//[(),]}// /:}}:}
)
_store_cache svn_cmds _svn_cmds
fi
fi
case $state in
@ -29,10 +38,20 @@ _svn () {
if (( $#cmd )); then
curcontext="${curcontext%:*:*}:svn-${cmd}:"
usage=${${(M)${(f)"$(LC_ALL=C _call_program options svn help $cmd)"}:#usage:*}#usage:*$cmd] }
args=(
${=${${${(M)${(f)"$(LC_ALL=C _call_program options svn help $cmd)"#(*Valid options:|(#e))}:#* :*}%% #:*}/ (arg|ARG)/:arg:}/(#b)-([[:alpha:]]) \[--([a-z-]##)\](:arg:)#/(--$match[2])-$match[1]$match[3] (-$match[1])--$match[2]$match[3]}
)
if ! _cache_invalid svn-${cmd}-usage && \
! _retrieve_cache svn-${cmd}-usage;
then
usage=${${(M)${(f)"$(LC_ALL=C _call_program options svn help $cmd)"}:#usage:*}#usage:*$cmd] }
_store_cache svn-${cmd}-usage usage
fi
if ! _cache_invalid svn-${cmd}-usage && \
! _retrieve_cache svn-${cmd}-args;
then
args=(
${=${${${(M)${(f)"$(LC_ALL=C _call_program options svn help $cmd)"#(*Valid options:|(#e))}:#* :*}%% #:*}/ (arg|ARG)/:arg:}/(#b)-([[:alpha:]]) \[--([a-z-]##)\](:arg:)#/(--$match[2])-$match[1]$match[3] (-$match[1])--$match[2]$match[3]}
)
_store_cache svn-${cmd}-args args
fi
case $cmd in;
(add)
@ -297,4 +316,13 @@ _subversion () {
esac
}
_svn_caching_policy() {
# Rebuild every week
local -a oldp
oldp=( "$1"(Nmw+1) )
(( $#oldp ))
}
_subversion "$@"

View file

@ -0,0 +1,92 @@
#compdef unison
local context state line
typeset -A opt_args
_arguments \
'-auto[automatically accept default (nonconflicting) actions]' \
'-batch[batch mode\: ask no questions at all]' \
'-doc[show documentation]:topics:(about people lists status copying ack install tutorial basics failures running ssh news all topics)' \
'-follow[add a pattern to the follow list]:pattern:' \
'-force[force changes from this replica to the other]:replica:' \
'-group[synchronize group attributes]' \
'-ignore[add a pattern to the ignore list]:pattern:' \
'-ignorenot[add a pattern to the ignorenot list]:pattern:' \
'-owner[synchronize owner]' \
'-path[path to synchronize]:path:_files' \
'-perms[part of the permissions which is synchronized]:perms:' \
'-prefer[choose this replicas version for conflicting changes]:replica:' \
'-root[root of a replica (should be used exactly twice)]:path:_files -/' \
'-silent[print nothing except error messages]' \
'-terse[suppress status messages]' \
'-testserver[exit immediately after the connection to the server]' \
'-times[synchronize modification times]' \
'-version[print version and exit]' \
'-addprefsto[add new prefs to]:file:_files' \
'-addversionno[add version number to name of unison on server]' \
'-backup[add a pattern to the backup list]:pattern:' \
'-backupcurr[add a pattern to the backupcurr list]:pattern:' \
'-backupcurrnot[add a pattern to the backupcurrnot list]:pattern:' \
'-backupdir[directory for storing centralized backups]:directory:_files -/' \
'-backuploc[where backups are stored]:backup location:(local central)' \
'-backupnot[add a pattern to the backupnot list]:pattern:' \
'-backupprefix[prefix for the names of backup files]:prefix:' \
'-backups[keep backup copies of all files]' \
'-backupsuffix[a suffix to be added to names of backup files]:suffix:' \
'-confirmbigdel[ask about whole-replica (or path) deletes (default true)]' \
'-confirmmerge[ask for confirmation before commiting results of a merge]' \
'-contactquietly[suppress the "contacting server" message during startup]' \
'-copyprog[external program for copying large files]:program:_files -g "*(-x)"' \
'-copyprogrest[variant of copyprog for resuming partial transfers]:program:_files -g "*(-x)"' \
'-copyquoterem[add quotes to remote file name for copyprog]:quote style:(true false default)]' \
'-copythreshold[use copyprog on files bigger than this]:size (kb):' \
'-debug:debug module:(all verbose)' \
'-diff[command for showing differences between files]:program:_files -g "*(-x)"' \
'-dontchmod[When set, never use the chmod system call]' \
'-dumbtty[do not change terminal settings in text UI]' \
'-fastcheck:fast update detection:(true false default)' \
'-forcepartial[add a pattern to the forcepartial list]:pattern:' \
'-height[height of main window in graphical interface]:number (lines):' \
'-host[bind the socket to this host name in server socket mode]:host:_hosts' \
'-ignorecase[identify upper/lowercase filenames]:ignorecase:(true false default)' \
'-ignorelocks[ignore locks left over from previous run (dangerous!)]' \
'-immutable[add a pattern to the immutable list]:pattern:' \
'-immutablenot[add a pattern to the immutablenot list]:pattern:' \
'-key[define a keyboard shortcut for this profile (in some UIs)]:shortcut:' \
'-killserver[kill server when done (even when using sockets)]' \
'-label[provide a descriptive string label for this profile]:label:' \
'-log[record actions in logfile (default true)]' \
'-logfile:logfile name:_files' \
'-maxbackups[number of backed up versions of a file]:number:' \
'-maxthreads[maximum number of simultaneous file transfers]:number:' \
'-merge[add a pattern to the merge list]:pattern:' \
'-mountpoint[abort if this path does not exist]:mountpoint:_files -/' \
'-numericids[dont map uid/gid values by user/group names]' \
'-preferpartial[add a pattern to the preferpartial list]:pattern:' \
'-pretendwin[Use creation times for detecting updates]' \
'-repeat[synchronize repeatedly (text interface only)]:repeat:' \
'-retry[re-try failed synchronizations N times (text ui only)]:retry times:' \
'-rootalias[register alias for canonical root names]:root alias:' \
'-rsrc:synchronize resource forks:(true false default)' \
'-rsync[activate the rsync transfer mode (default true)]' \
'-selftest[run internal tests and exit]' \
'-servercmd[name of unison executable on remote server]:program:_files -g "*(-x)"' \
'-showarchive[show "true names" (for rootalias) of roots and archive]' \
'-socket[act as a server on a socket]:socket:_files -g "*(-=)"' \
'-sortbysize[list changed files by size, not name]' \
'-sortfirst[add a pattern to the sortfirst list]:pattern:' \
'-sortlast[add a pattern to the sortlast list]:pattern:' \
'-sortnewfirst[list new before changed files]' \
'-sshargs[other arguments (if any) for remote shell command]:ssh args:' \
'-sshcmd[path to the ssh executable]:program:_files -g "*(-x)"' \
'-ui:user interface:(text graphic)' \
'-xferbycopying[optimize transfers using local copies (default true)]' \
'*:profile:->profile'
if [[ $state == profile ]]; then
local -a profiles
profiles=( ~/.unison/*.prf(N) )
(( $#profiles )) && \
compadd "$@" - ${${profiles#~/.unison/}%.prf}
fi

View file

@ -0,0 +1,6 @@
#compdef xournal
local expl
_description files expl 'PDF and Xournal files'
_files "$@" "$expl[@]" -g '*.(#i){xoj,pdf}(-.)'

View file

@ -1,4 +1,4 @@
#compdef pdf2dsc pdf2ps pdfimages pdfinfo pdftopbm pdftops pdftotext pdfopt pdffonts kpdf okular
#compdef pdf2dsc pdf2ps pdfimages pdfinfo pdftopbm pdftops pdftotext pdfopt pdffonts kpdf
local expl ext=''

View file

@ -4,6 +4,8 @@ _acroread _dcop
_gnome-gv _gqview _gv _kfmclient
_mozilla _mplayer _nautilus
_nedit _netscape
_okular
_pdftk
_qiv
_setxkbmap
_urxvt _vnc

View file

@ -34,7 +34,7 @@ _arguments \
'--arguments=:ghostscript arguments:' \
'--page=:label of first page:' \
'--media=:page size:(Letter Legal Statement Tabloid Ledger Folio Quarto 10x14 Executive A3 A4 A5 B4 B5)' \
'--orientation=:orientation:' \
'--orientation=:orientation:(landscape seascape upsidedown portrait)' \
'--scale=:scale entry:' \
'--scalebase=:scale base:' \
'--ad=:resource file:_files' \

View file

@ -0,0 +1,10 @@
#compdef okular
local extns
extns="{pdf,ps,eps,dvi}(.gz|.bz2)(#c,1)|djvu|tiff|chm|cbr|cbz"
_arguments \
'(-p --page)'{-p,--page}'[Page of the document to be shown]:page: ' \
'--presentation[Start the document in presentation mode]' \
'--unique[Unique instance control]' \
"*:Okular documents:_files -g '*.(#i)($extns)(-.)'"

View file

@ -0,0 +1,63 @@
#compdef pdftk
_pdfwithhandle()
{
compset -P '(#I)[A-Z]='
_files "$@" -g '(#i)*.pdf'
}
local expl
local -a opts operations
opts=(output encrypt_40bit encrypt_128bit allow owner_pw user_pw flatten
compress uncompress keep_first_id keep_final_id drop_xfa verbose
dont_ask do_ask)
operations=(cat attach_files unpack_files burst fill_form background stamp
generate_fdf multibackground multistamp dump_data dump_data_fields
update_info)
case $words[CURRENT-1] in
((input|owner|user)_pw)
_message "password, or PROMPT"
;;
(allow)
#_description permissions expl "permission"
#compadd $expl \
_values -s , permissions \
Printing DegradedPrinting ModifyContents Assembly CopyContents \
ScreenReaders ModifyAnnotations FillIn AllFeatures
;;
(attach_files)
_files "$@"
;;
(fill_form)
_description files expl 'FDF and XFDF files'
_files "$@" $expl -g '(#i)*.(fdf|xfdf)'
;;
((multibackground|background|stamp|multistamp|output))
_description files expl 'PDF files'
_files "$@" $expl -g '(#i)*.pdf'
;;
(update_info)
_files
;;
(*)
false
;;
esac && return 0
if [[ -n $words[(r)(${(j:|:)operations})] ]]; then
_description options expl "options"
compadd $@ $expl $opts
else
_tags files operations
_alternative \
'files:PDF files:_pdfwithhandle' \
"operations:operations:($operations)"
fi

View file

@ -25,6 +25,7 @@ case $service in
'-depth:depth' \
'-passwd:file:_files' \
'(1)-listen:display number' \
'-via:host:_hosts' \
'(-listen)1::display:_x_display'
;;
esac

View file

@ -1,4 +1,11 @@
#compdef xrandr
local context state line
typeset -A opt_args
local outputs modes expl
# User configurable. TODO -- styles?
outputs=(LVDS1 TV1 VGA1)
modes=(1280x800 1024x768 800x600 640x480)
_arguments \
'(-d -display)'{-d,-display}':X display:_x_display' \
@ -6,28 +13,50 @@ _arguments \
'(-o --orientation)'{-o,--orientation}':rotation:(normal inverted left right 0 1 2 3)' \
'(-q --query)'{-q,--query}'[display current state]' \
'(-s --size)'{-s,--size}':size:' \
'(-r --rate --refresh)'{-r,--rate,--refresh}':target refresh rate:' \
'(-r --rate --refresh)'{*-r,*--rate,*--refresh}':target refresh rate:' \
'(-v --version)'{-v,--version}'[display version]' \
'-x[reflect across X axis]' \
'-y[reflect across Y axis]' \
'--screen:X screen number' \
'--verbose[be more verbose]' \
'--dryrun' \
'--nograb' \
'(--prop --properties)'{--prop,--properties}'[display the contents of properties for each output]' \
'--fb:size:' \
'--fbmm:size:' \
'--dpi:dpi:' \
'--output:output to reconfigure:' \
'--auto' \
'--mode:mode:' \
'--preferred' \
'--pos:position:' \
'--reflect:axes:(normal x y xy)' \
'--rotate:rotation:(normal inverted left right)' \
'--left-of:output' \
'--right-of:output' \
'--above:output' \
'--below:output' \
'--same-as:output' \
'--off[disable the output]' \
'--crtc:crtc to use:'
"*--output:output to reconfigure:($outputs)" \
'*--auto' \
"*--mode:mode:($modes)" \
'*--preferred' \
'*--pos:position:' \
'*--reflect:axes:(normal x y xy)' \
'*--rotate:rotation:(normal inverted left right)' \
"*--left-of:relative position to:($outputs)" \
"*--right-of:relative position to:($outputs)" \
"*--above:relative position to:($outputs)" \
"*--below:relative position to:($outputs)" \
"*--same-as:relative position to:($outputs)" \
'*--set:property:(Backlight scaling\ mode):value:->value' \
'*--scale:output scaling:' \
'*--transform:transformation matrix:' \
'*--off[disable the output]' \
'*--crtc:crtc to use:' \
'*--panning:panning:' \
'*--gamma:r\:g\:b:' \
'*--primary' \
'--noprimary' \
'*--newmode:name: :clock MHz: :hdisp: :hsync-start: :hsync-end: :htotal: :vdisp: :vsync-start: :vsync-end: :vtotal:' \
'*--rmmode:Mode name:' \
"*--addmode:output:($outputs):name:" \
"*--delmode:output:($outputs):name:" \
&& return 0
if [[ $state == value ]]; then
case $words[CURRENT-1] in
(scaling* mode)
_description value expl "output property 'scaling mode'"
compadd "$@" "$expl[@]" None Full Center Full\ aspect && return 0
;;
esac
fi

View file

@ -221,9 +221,6 @@ mostlyclean-modules clean-modules distclean-modules realclean-modules:
install.modules uninstall.modules \
modobjs modules headers proto $(MAIN_OBJS) zsh.export: Makemod
@if [ ! -f Builtins/Makefile.in ]; then \
$(MAKE) prep; \
fi
@$(MAKE) -f Makemod $(MAKEDEFS) $@
.PHONY: install.modules uninstall.modules headers proto

View file

@ -116,8 +116,9 @@ prep:
done
.PHONY: prep
headers prep: $(dir_src)/modules.stamp
headers: $(dir_src)/modules.stamp
$(dir_src)/modules.stamp: $(MDDS)
$(MAKE) -f $(makefile) $(MAKEDEFS) prep
echo 'timestamp for *.mdd files' > $@
.PHONY: headers