zsh-workers
 help / color / mirror / code / Atom feed
15b92a6343a30dc6c982f6498f4aa3ecce951731 blob 2172 bytes (raw)

 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
 
#compdef sed gsed psed s2p

local args inplace extended

args=(
  '(-n --quiet --silent)'{-n,--quiet,--silent}'[suppress automatic printing of pattern space]'
  '(1)*'{-e,--expression=-}'[specify sed commands to run]:sed script'
  '(1)*'{-f,--file=-}'[add contents of file to commands to run]:file:_files'
  '(-e)1: :_guard "^-*" sed script'
  '*:input file:_files'
)
inplace='[edit files in-place, running scripts separately for each file]::suffix for backup'
extended='[use extended regular expressions]'

if [[ $service = (psed|s2p) ]]; then
  args=(
    "${(@)args:#(|\(*\))(|\*)--*}"
    '-a[delay opening files listed with w function]'
  )
elif _pick_variant gnu=GNU unix --version; then
  args+=(
    '--follow-symlinks[follow symlinks when processing in place]'
    '(-i --in-place)'{-i-,--in-place=-}$inplace
    '(-c --copy)'{-c,--copy}'[copy instead of rename when shuffling files in in-place mode]'
    '(-l --line-length)'{-l,--line-length=-}'[specify line-wrap length for the l command]'
    '(-r)--posix[disable GNU extensions]'
    '(-E -r --regexp-extended)'{-E,-r,--regexp-extended}$extended
    '(-s --separate)'{-s,--separate}'[consider files separately instead of as a combined stream]'
    '--sandbox[block commands that can affect the system (r/w/W/e)]'
    '(-u --unbuffered)'{-u,--unbuffered}'[disable data buffering]'
    '(-z --null-data)'{-z,--null-data}'[separate lines by NUL characters]'
    '(- 1 :)--help[print program usage]'
    '(- 1 :)--version[print program version]'
  )
else
  args=( "${(@)args:#(|\(*\))(|\*)--*}" )
  case $OSTYPE in
    openbsd*|freebsd*|netbsd*|darwin*|dragonfly*)
      args+=(
	'(-r -E)'{-r,-E}$extended
	'-a[delay opening files listed with w function]'
      )
    ;|
    darwin*|freebsd*|netbsd*|openbsd*)  args+=( '-i'$inplace ) ;|
    darwin*|freebsd*|netbsd*) args+=( '-l[make output line buffered]' ) ;|
    freebsd*) args+=( '-u[disable data buffering]' ) ;|
    freebsd*|netbsd*)
      args+=(
        '-I[edit files in-place, treating all files as a single input stream]::suffix for backup'
      )
    ;;
    openbsd*) args+=( '-u[make output line buffered]' ) ;;
  esac
fi

_arguments -s "$args[@]"
debug log:

solving 15b92a634 ...
found 15b92a634 in https://git.vuxu.org/mirror/zsh/

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).