File: _dochelp

package info (click to toggle)
dochelp 0.1.7
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 148 kB
  • sloc: ml: 504; makefile: 49; ansic: 19; sh: 9
file content (60 lines) | stat: -rw-r--r-- 1,421 bytes parent folder | download | duplicates (3)
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
53
54
55
56
57
58
59
60
#compdef dochelp

_dochelp-cat() {
   _arguments \
     ':docid Document ID to print:_files'
}

_dochelp-info() {
   _arguments \
     ':docid Document ID to print:_files'
}

_dochelp-search() {
   _arguments \
     ':optional regexp:_files'
}

_dochelp-update() {
   _arguments \
     '::optional target:_files' \
     '--online[Use relative paths in generated HTML page]'
}

_dochelp() {
   local curcontext="$curcontext" state line
   typeset -A opt_args
   _arguments -C \
      ':command:->command' \
      '*::options:->options' \

   case $state in
   (command)
      #breaks if defined outside the func
      local -a subcommands
      subcommands=(
                        'cat:Dump the content of a document'
                        'info:Print available information about a document'
                        'list:List known registered documents'
                        'search:Look for matching documents'
                        'update:Print available information for a document'
      )

      _describe -t commands dochelp subcommands
   ;;
   (options)
      _arguments \
        '--help[print a help message]' \
        '--version[print version number]' \
        '--base-doc[Specify doc-base directory]:directory:_path_files -/'

      local funcname
      funcname=_dochelp-$line[1]
      if type $funcname | grep -q "shell function" ; then
         $funcname
      fi
   ;;
   esac
}

_dochelp "$@"