about summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Unix/Command/.distfiles2
-rw-r--r--Completion/Unix/Command/_sablotron52
2 files changed, 53 insertions, 1 deletions
diff --git a/Completion/Unix/Command/.distfiles b/Completion/Unix/Command/.distfiles
index 304b63d79..7dfbf3d44 100644
--- a/Completion/Unix/Command/.distfiles
+++ b/Completion/Unix/Command/.distfiles
@@ -19,5 +19,5 @@ _user_admin   _rsync        _arping	  _spamassassin _mtools	      _fsh
 _chkconfig    _cdcd         _irssi	  _sccs         _texinfo      _ant
 _global       _global_tags  _figlet       _ifconfig     _last         _larch
 _lsof         _mt           _xmlsoft      _elinks       _tidy         _python
-_antiword     _renice
+_antiword     _renice       _sablotron
 '
diff --git a/Completion/Unix/Command/_sablotron b/Completion/Unix/Command/_sablotron
new file mode 100644
index 000000000..846249821
--- /dev/null
+++ b/Completion/Unix/Command/_sablotron
@@ -0,0 +1,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 value
+      else
+        _message '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