File: _zsh

package info (click to toggle)
zsh 5.9-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 23,856 kB
  • sloc: ansic: 108,138; sh: 6,976; makefile: 722; perl: 687; awk: 291; sed: 16
file content (26 lines) | stat: -rw-r--r-- 696 bytes parent folder | download | duplicates (4)
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
#compdef zsh

local curcontext=$curcontext state state_descr line expl not='!'
typeset -A opt_args

[[ $CURRENT = 2 ]] && not=''

_arguments -S -s : \
  ${not}'--emulate[specify emulation mode]:mode:(zsh sh ksh csh)' \
  '*-o+[set named option]:option:_options' \
  '*+o+[unset named option]:option:_options' \
  '(1 -s --shinstdin)'{-s,--shinstdin}'[read commands from standard input]' \
  '(-)-b[end of option processing, like --]' \
  '(1 -)-c[run a command]:command:_cmdstring' \
  '(-)1:script file:_files' \
  '*::script arguments:->args' -- && return 0

case $state in
  (args)
    if [[ -n ${opt_args[(I)-c|-s|--shinstdin]} ]]; then
      _files
    else
      _normal
    fi
    ;;
esac