-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
/
Copy pathsoftwareupdate.ts
153 lines (152 loc) · 3.98 KB
/
softwareupdate.ts
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
const updatesGenerator: Fig.Generator = {
script: ["softwareupdate", "--list"],
postProcess: (out) => {
return out
.split("\n")
.filter((line) => line.startsWith("* Label: "))
.map((line) => {
const name = line.substring(9);
return {
name: name,
insertValue: `"${name}"`,
description: "Available update",
};
});
},
scriptTimeout: 20000,
cache: {
strategy: "stale-while-revalidate",
ttl: 1000 * 60 * 60 * 2,
},
};
const completionSpec: Fig.Spec = {
name: "softwareupdate",
description:
"Software Update checks for new and updated versions of your software based on information about your computer and current software",
subcommands: [
/** Manage updates: */
{
name: ["-l", "--list"],
description: "List all appropriate update labels",
},
{
name: ["-d", "--download"],
description: "Download Only",
},
{
name: ["-i", "--install"],
description: "Install",
args: {
name: "label",
isVariadic: true,
isOptional: true,
generators: updatesGenerator,
},
options: [
{
name: ["-a", "--all"],
description: "All appropriate updates",
exclusiveOn: ["-r", "--recommended"],
},
{
name: ["-R", "--restart"],
description:
"Automatically restart (or shut down) if required to complete installation",
},
{
name: ["-r", "--recommended"],
description: "Only recommended updates",
exclusiveOn: ["-a", "--all"],
},
],
},
{
name: "--list-full-installers",
description: "List the available macOS Installers",
},
{
name: "--fetch-full-installer",
description: "Install the latest recommended macOS Installer",
},
{
name: "--full-installer-version",
description: "The version of macOS to install",
args: { name: "version" },
},
{
name: "--install-rosetta",
description: "Install Rosetta 2",
},
{
name: "--background",
description: "Trigger a background scan and update operation",
},
/** Other Tools: */
{
name: "--dump-state",
description:
"Log the internal state of the SU daemon to /var/log/install.log",
},
{
name: "--evaluate-products",
description:
"Evaluate a list of product keys specified by the --products option",
},
{
name: "--history",
description:
"Show the install history. By default, only displays updates installed by softwareupdate",
options: [
{
name: "--all",
description:
"Include all processes in history (including App installs)",
},
],
},
],
options: [
{
name: "--no-scan",
description:
"Do not scan when listing or installing updates (use available updates previously scanned)",
isPersistent: true,
},
{
name: "--product-types",
description:
"Limit a scan to a particular product type only - ignoring all others",
args: { name: "type" },
isPersistent: true,
},
{
name: "--products",
description:
"A comma-separated (no spaces) list of product keys to operate on",
isPersistent: true,
},
{
name: "--force",
description:
'Force an operation to complete. Use with --background to trigger a background scan regardless of "Automatically check" pref',
isDangerous: true,
isPersistent: true,
},
{
name: "--agree-to-license",
description:
"Agree to the software license agreement without user interaction",
isPersistent: true,
},
{
name: "--verbose",
description: "Enable verbose output",
isPersistent: true,
},
{
name: ["--help", "-h"],
description: "Show help for softwareupdate",
},
],
};
export default completionSpec;