mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-11-19 13:33:52 +01:00
53 lines
1.8 KiB
Plaintext
53 lines
1.8 KiB
Plaintext
#compdef sabcmd
|
|
|
|
local curcontext="$curcontext" state mode line expl ret=1
|
|
typeset -A opt_args
|
|
local mopts='(-c -x -s -? -v --chain-xsl --batch-xml --batch-xsl --help --version)'
|
|
|
|
_arguments -C \
|
|
'(-b --base)'{-b,--base=}'[specify base URI]:URI' \
|
|
'(-)--debug-options[show help on debug options]' \
|
|
'(- *)'{-\?,--help}'[show help information]' \
|
|
'(-L --log-file)'{-L,--log-file=}'[specify log file, turn on logging]:log file:_files' \
|
|
'(-m --measure)'{-m,--measure}'[measure the processing time]' \
|
|
'(- *)'{-v,--version}'[display version information]' \
|
|
'--debugger[run the xslt debugger]' \
|
|
$mopts{-c,--chain-xsl}'[single input file, multiple chained stylesheets]' \
|
|
$mopts{-x,--batch-xml}'[single input file, multiple stylesheets]' \
|
|
$mopts{-s,--batch-xsl}'[multiple input files, single stylesheet]' \
|
|
'*: :->arguments' && ret=0
|
|
|
|
if [[ -n "$state" ]]; then
|
|
mode="${opt_args[(i)-c|--chain-xsl]:+chain}${opt_args[(i)-x|--batch-xml]:+batch-x}${opt_args[(i)-s|--batch-xsl]:+batch-s}"
|
|
[[ $mode = (chain|batch-[xs]) ]] || mode=default
|
|
_tags assignments files
|
|
while _tags; do
|
|
if _requested assignments; then
|
|
if [[ -prefix *= ]]; then
|
|
_message -e value value
|
|
else
|
|
_message -e parameter 'parameter name'
|
|
fi
|
|
fi
|
|
if _requested files; then
|
|
case $mode:${#words[1,CURRENT-1]:#(-*|*=*)}; in
|
|
default:1|chain:<3->|batch-x:2|batch-s:1)
|
|
_description files expl stylesheet
|
|
_files "$expl[@]" -g "*.xsl(-.)" && ret=0
|
|
;;
|
|
default:2|chain:1|batch-x:1|batch-s:2)
|
|
_description files expl 'input file'
|
|
_files "$expl[@]" && ret=0
|
|
;;
|
|
default:3|chain:2|batch-x:<3->|batch-s:<3->)
|
|
_description files expl 'output file'
|
|
_files "$expl[@]" && ret=0
|
|
;;
|
|
esac
|
|
fi
|
|
(( ret )) || break
|
|
done
|
|
fi
|
|
|
|
return ret
|