zsh-workers
 help / color / mirror / code / Atom feed
91bd3b5f1246bbed474a4d79faf1df225b4e9071 blob 3132 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
 
#compdef date gdate

local curcontext="$curcontext" state state_descr line ret=1
local -A opt_args
local -a opts args

opts=( -s -w -C )

if _pick_variant gnu="Free Software Foundation" unix --version; then
  local d='(-d --date -f --file -r --reference -s --set)'
  local f='(-I --iso-8601 -R --rfc-email --rfc-3339)'
  args=(
    $d{-d+,--date=}'[output date specified by string]:time string'
    '--debug[annotate parsed date and warn about questionable usage]'
    $d{-f+,--file=}'[output dates specified in file]:file:_files'
    $d{-r+,--reference=}'[output last modification time of specified file]:file:_files'
    $d{-s+,--set=}'[set time]:time string'
    $f{-I-,--iso-8601=-}'[display in ISO 8601 format]::precision:(date hours minutes seconds ns)'
    $f{-R,--rfc-email}'[display in RFC5322 format]'
    $f'--rfc-3339=-[display in RFC 3339 format]:precision:(date seconds ns)'
    '(-u --utc --universal)'{-u,--utc,--universal}'[display or set time in UTC]'
    '(- :)--help[output help and exit]'
    '(- :)--version[output version info and exit]'
  )
else
  args=( '-u[display or set time in UTC]' )
  case "$OSTYPE" in
    solaris*)
      args+=( '-a:adjustment' )
    ;;
    freebsd*|dragonfly*|darwin*|netbsd*|openbsd*)
      opts+=( -A '-*' )
      args+=(
	"-j[don't try to set date]"
	'2:format or date:->fmt_date'
      )
    ;|
    freebsd*|dragonfly*|darwin*|netbsd*)
      args+=( '-n[only set time on current machine]' )
    ;|
    freebsd*|dragonfly*|darwin*|openbsd*)
      args+=(
	'-d+:daylight saving time value'
	'-f+[use specified format for input]:parsing format:_date_formats:new date'
	'-t+:minutes west of GMT'
      )
    ;|
    dragonfly*|darwin*|netbsd*|openbsd*)
      args+=(
	'-r+[output date specified by reference time]:seconds since epoch'
      )
    ;|
    freebsd*)
      local -a alts
      alts=(
	'seconds:sec:_guard "(0x[0-9a-fA-F]#|[0-9]#)" "seconds since epoch"'
	'files:file:_files'
      )
      args+=(
	'-r+[reference time: file modification or literal time]:reference: _alternative $alts'
	'(-R)-I-[display in ISO 8601 format]::precision:(date hours minutes seconds)'
      )
    ;|
    freebsd*|dragonfly*|darwin*)
      args+=( "*-v+[adjust and print (but don't set) date]:[+-]value[ymwdHMS]" )
    ;;
    freebsd*|dragonfly*)
      args+=( '-R[display in RFC2822 format]' )
    ;|
    openbsd*|netbsd*) args+=( '-a[gradually skew]' )
    ;|
    openbsd*)
      args+=( '-z[specify timezone for output]:time zone:_time_zone')
    ;|
    netbsd*)
      args+=( '-d[output date specified by string]:time string:' )
    ;;
  esac
fi

_arguments $opts : $args \
  '1:format or date:->fmt_date' && ret=0

case $state in
  (fmt_date)
    local expl
    if compset -P '+'; then
      _wanted date-formats expl 'output format' _date_formats && ret=0
    elif [[ $words[CURRENT] != -* ]]; then
      # TODO: in most cases it should be possible to determine which
      # (or both or neither) of the +format and/or date is allowed
      # depending on the options already on the command line
      _message -e date-formats '+format or date' && ret=0
    fi
    ;;
esac

return ret
debug log:

solving 91bd3b5f1 ...
found 91bd3b5f1 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).