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
|
#compdef dochelp
local curcontext="$curcontext" state line ret=1
_list_doc_base_documents () {
dochelp --list
}
_arguments -C \
'(- 1 *)'{-help,--help}'[display help information]' \
'(- 1 *)--version[display version information]' \
'(--list)'{--list}'[List available documents]' \
'(--search)'{--search}"[Look for a matching document]:regexp" \
'(--info)'{--info}'[Print available information for a document]:document id' \
'(--open)'{--open}'[Open given document]:document id' \
'(--update)'{--update}'[Update global indexes]' \
'(--target)'{--target}'[Specify path of the generated html page]:' \
'(--online)'{--online}'[Use relative paths in generated HTML page]' \
'--base-doc[Specify doc-base dir]' \
'--version[Print version number]' \
'*: :->args' && ret=0
case $state in
args)
case $line[1] in
-i|--info|-o|--open)
_list_doc_base_documents && ret=0
;;
*)
(( ret )) && _message 'no more arguments'
;;
esac
;;
esac
return ret
|