zsh-workers
 help / color / mirror / code / Atom feed
6bd5c6d6beacdd01fdd4f5b4bf584a4ec3833e3b blob 2800 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
 99
100
101
102
103
104
105
 
#autoload

local flag
local -aU specs
local -A exclusion

exclusion=(
  'E' '[cCgGxXyY]'
  'O' '[BdeHImMSuUVwWy]'
  '-' '[OEdegHIjklmMSUz]'
  '_' '[OEdgHIjmMSUz]'
  '0' '[Oekl]'
  '^' '[OEaAbBchP]'
  '#' '[OEaAbBchpPrXZ]'
)

compset -P '(%[0-9EO_\\^#-]#[^0-9%EO_\\^#-]|[^%])#'
compset -S '%*'
specs=(
  'a:abbreviated day name'
  'A:full day name'
  {b,h}':abbreviated month name'
  'B:full month name'
  'c:preferred locale date and time'
  'C:2-digit century'
  'd:day of month (01-31)'
  'D:american format month/day/year (%m/%d/%y)'
  'e:day of month ( 1-31)'
  'F:ISO 8601 year-month-date (%Y-%m-%d)'
  'G:4-digit ISO 8601 week-based year'
  'g:2-digit ISO 8601 week-based year'
  'H:hour (00-23)'
  'I:hour (01-12)'
  'j:day of year (001-366)'
  'k:hour ( 0-23)'
  'l:hour ( 1-12)'
  'm:month (01-12)'
  'M:minute (00-59)'
  'n:newline'
  'p:locale dependent AM/PM'
  'r:locale dependent a.m. or p.m. time (%I:%M:%S %p)'
  'R:24-hour notation time (%H:%M)'
  's:seconds since the epoch'
  'S:seconds (00-60)'
  't:tab'
  'T:24-hour notation with seconds (%H:%M:%S)'
  'u:day of week (1-7, 1=monday)'
  'U:week number of current year, sunday based (00-53)'
  'V:ISO 8601 week number of current year, week 1 has 4 days in current year (01-53)'
  'w:day of week (0-6, 0=sunday)'
  'W:week number of current year, monday based (00-53)'
  'x:locale dependent date representation without time'
  'X:locale dependent time representation without date'
  'y:2-digit year (00-99)'
  'Y:full year'
  'z:UTC offset'
  'Z:timezone name'
  '%:A %'
)

case $OSTYPE in
  freebsd*|dragonfly*|darwin*|linux-gnu|solaris2.<11->)
    specs+=(
      'E:alternate representation'
      'O:alternative format modifier'
      "-:don't pad numeric values"
      '0:left pad numeric values with zeroes'
      '_:left pad numeric values with spaces'
    )
  ;|
  linux-gnu|solaris2.<11->)
    specs+=(
      '#:swap case of alphabetic characters'
      '^:convert lowercase characters to uppercase'
      'P:lower case locale dependent am/pm'
    )
  ;|
  freebsd*|dragonfly*|darwin*|openbsd*|netbsd*)
    specs+=( 'v:date in short form (%e-%b-%Y)' )
  ;|
  solaris2.<11->|freebsd*|dragonfly*|darwin*|openbsd*)
    specs+=( '+:localized representation of date and time' )
  ;;
  solaris2.<-10>)
    specs=( ${specs:#[EOs]:*} )
  ;;
esac

if [[ $1 == zsh ]]; then
  specs+=(
    'f:day of month (1-31)'
    'K:hour (0-23)'
    'L:hour (0-12)'
    '.:fractional part of seconds since epoch'
    "-:don't pad numeric values"
  )
fi

for flag in ${(s..)PREFIX#%}; do
  (( $+exclusion[$flag] )) && specs=( ${(M)specs:#${~exclusion[$flag]}:*} )
done

_describe -t date-format-specifier 'date format specifier' specs \
    -p "${(Q)PREFIX:-%}" -S ''
[[ $1 == zsh ]] && _message -e date-format-precision 'precision for %%. (1-6)'
debug log:

solving 6bd5c6d6b ...
found 6bd5c6d6b 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).