zsh-workers
 help / color / mirror / code / Atom feed
3b3aa221996b6c69e79e0316c668173c2b1ba98b blob 1944 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
 
#compdef locale

# TODO: FreeBSD: locale -k list [prefix]

local curcontext="$curcontext" state line expl ret=1

if _pick_variant gnu='(GNU|EGLIBC)' unix --version; then

  local exargs="-? --help --usage -V --version"

  _arguments -A "-*" -C -S -s \
    '(- *)'{-\?,--help}'[display help information]' \
    '(- *)--usage[display a short usage message]' \
    '(- *)'{-V,--version}'[print program version]' \
    - set1 \
    "(-a --all-locales $exargs)"{-a,--all-locales}'[list all available locales]' \
    "(-v --verbose $exargs)"{-v,--verbose}'[display additional information]' \
    - set2 \
    "(-m --charmaps $exargs)"{-m,--charmaps}'[list all available charmaps]' \
    - set3 \
    "(-c --category-name $exargs)"{-c,--category-name}'[print also locale category]' \
    "(-k --keyword-name $exargs)"{-k,--keyword-name}'[print also keyword of each value]' \
    '*:name:->catkey' \
    && return 0

  if [[ $state == catkey ]]; then
    typeset -a cats keys
    cats=( ${${${(f)"$(locale)"}%=*}%(LANG|LANGUAGE|LC_ALL)} )
    keys=( ${${(f)"$(locale -k $cats 2>/dev/null)"}%=*} )
    _wanted values expl name compadd "$@" -a - cats keys && ret=0
  fi

  return ret

elif [[ $OSTYPE == openbsd* ]]; then

  _arguments \
    - set1 \
    "(-a)"-a'[list all available locales]' \
    - set2 \
    "(-m)"-m'[list all available charmaps]' \
    && return 0

  return ret

else

  _arguments -A "-*" -C \
    - set1 \
    "(-a)"-a'[list all available locales]' \
    - set2 \
    "(-m)"-m'[list all available charmaps]' \
    - set3 \
    "(-c)"-c'[print also locale category]' \
    "(-k)"-k'[print also keyword of each value]' \
    '*:name:->catkey' \
    && return 0

  if [[ $state == catkey ]]; then
    typeset -a cats keys
    cats=( ${${${(f)"$(locale)"}%=*}%(LANG|LANGUAGE|LC_ALL)} )
    keys=( ${${(f)"$(locale -k $cats 2>/dev/null)"}%=*} )
    _wanted values expl name compadd "$@" -a - cats keys && ret=0
  fi

  return ret

fi
debug log:

solving 3b3aa22 ...
found 3b3aa22 in https://inbox.vuxu.org/zsh-workers/574C7A09.7010800@redhat.com/

applying [1/1] https://inbox.vuxu.org/zsh-workers/574C7A09.7010800@redhat.com/
diff --git a/Completion/Unix/Command/_locale b/Completion/Unix/Command/_locale
new file mode 100644
index 0000000..3b3aa22

Checking patch Completion/Unix/Command/_locale...
Applied patch Completion/Unix/Command/_locale cleanly.

index at:
100644 3b3aa221996b6c69e79e0316c668173c2b1ba98b	Completion/Unix/Command/_locale

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).