zsh-workers
 help / color / mirror / code / Atom feed
9cad43dc1f3dac18b5ca189f6fe2988b8dd9a446 blob 2691 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
 
#compdef softwareupdate

_softwareupdate_update_name() {
  local name line
  if [[ ! -v _softwareupdate_updates ]]; then
    _softwareupdate_updates=()
    for line in ${(f)"$(_call_program pkgs softwareupdate --list)"}; do
      if [[ $line == '   '* ]]; then
        name="${line#   ? }"
      elif [[ -n "$name" ]]; then
        _softwareupdate_updates+=("$name:${line#	}")
        name=""
      fi
    done
  fi
  if (( ${#_softwareupdate_updates} > 0 )); then
    _describe -t pkgs "update name" _softwareupdate_updates && return 0
  fi
  return 1
}

_softwareupdate() {
  local context state line expl
  typeset -A opt_args

  _arguments -R \
    '(-h --help -l --list)-q[quiet mode]' \
    {-l,--list}'[list all available updates]:*:' \
    {-d,--download}'[download only]:*:' \
    {-i,--install}'[install (requires root)]:*: :->install' \
    '--list-full-installers[list the available macOS installers]' \
    '--fetch-full-installer[install the latest recommended macOS installer]:*: :->fetch-installer' \
    '--install-rosetta[install rosetta]' \
    '--background[trigger a background scan and update operation]' \
    '--schedule[scheduler preferences (per-user)]:automatic checking:(on off)' \
    '--dump-state[log the internal state of the SU daemon to /var/log/install.log]' \
    '--evaluate-products[evaluate a list of product keys specified by the --products option]' \
    '--history[show the install history]' \
    '--no-scan[do not scan when listing or installing updates]' \
    '--product-types[limit a scan to a particular product type only]:product_type' \
    '--products[a comma separated list of product keys to operate on]:product_keys' \
    '--force[force an operation to complete]' \
    '--agree-to-license[agree to the software license agreement without user interaction]' \
    '--verbose[enable verbose output]' \
    {-h,--help}'[print command usage]:*:' && return 0

  case "$state" in
    install)
      _arguments \
        '(-a --all)'{-a,--all}'[all available active updates]' \
        '(-r --recommended)'{-r,--recommended}'[all updates that are recommended for your system]' \
        '--os-only[only macOS updates]' \
        '--safari-only[only safari updates]' \
        '(-R --restart)'{-R,--restart}'[automatically restart if required to complete installation]' \
        '--stdinpass[password to authenticate as an owner]' \
        '--user[local username to authenticate as an owner]' \
        '*:update name:_softwareupdate_update_name' && return 0
      ;;
    fetch-installer)
      _arguments \
        '--full-installer-version[specify the version macOS to install]:version' \
      ;;
  esac
  return 1
}

_softwareupdate "$@"
debug log:

solving 9cad43dc1 ...
found 9cad43dc1 in https://inbox.vuxu.org/zsh-workers/20230628094734.130645-2-syohex@gmail.com/
found 6054fd768 in https://git.vuxu.org/mirror/zsh/
preparing index
index prepared:
100644 6054fd768bcf19f236fa78c4fe4677592a56aa6e	Completion/Darwin/Command/_softwareupdate

applying [1/1] https://inbox.vuxu.org/zsh-workers/20230628094734.130645-2-syohex@gmail.com/
diff --git a/Completion/Darwin/Command/_softwareupdate b/Completion/Darwin/Command/_softwareupdate
index 6054fd768..9cad43dc1 100644

Checking patch Completion/Darwin/Command/_softwareupdate...
Applied patch Completion/Darwin/Command/_softwareupdate cleanly.

index at:
100644 9cad43dc1f3dac18b5ca189f6fe2988b8dd9a446	Completion/Darwin/Command/_softwareupdate

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