blob: 170f08abdd92345ee0146c8b8fd939c00fc1c033 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#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
|