-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
/
Copy pathelm-json.ts
203 lines (201 loc) · 5.01 KB
/
elm-json.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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
import { filepaths } from "@fig/autocomplete-generators";
const packageList: Fig.Generator = {
script: [
"curl",
"-sH",
"accept-encoding: gzip",
"--compressed",
"https://package.elm-lang.org/search.json",
],
cache: {
ttl: 1000 * 24 * 60 * 60 * 3, // 3 days
},
postProcess: (output) => {
return JSON.parse(output).map((package_) => ({
name: package_.name,
description: package_.summary,
}));
},
};
/**
* Based on [elm-json](https://github.com/zwilias/elm-json), version 0.2.13. Cli tool for working with your elm.json file.
*/
const completionSpec: Fig.Spec = {
name: "elm-json",
description: "Deal with your elm.json",
subcommands: [
{
name: "help",
description:
"Prints help information or the help of the given subcommand(s)",
args: {
name: "subcommand",
template: "help",
},
},
{
name: "install",
description: "Install a package",
options: [
{
name: ["--help", "-h"],
description: "Prints help information",
},
{
name: "--test",
description: "Install as a test-dependency",
},
{
name: ["--version", "-V"],
description: "Prints version information",
},
{
name: "--yes",
description: 'Answer "yes" to all questions',
},
],
args: [
{
name: "PACKAGE",
description:
"Package to install, e.g. elm/core or elm/[email protected] or elm/core@1",
debounce: true,
generators: packageList,
},
{
name: "-- INPUT",
isOptional: true,
description: "The elm.json file to upgrade [default: elm.json]",
generators: filepaths({ extensions: ["json"] }),
},
],
},
{
name: "new",
description: "Create a new elm.json file",
options: [
{
name: ["--help", "-h"],
description: "Prints help information",
},
{
name: ["--version", "-V"],
description: "Prints version information",
},
],
},
{
name: "tree",
description: "List entire dependency graph as a tree",
options: [
{
name: ["--help", "-h"],
description: "Prints help information",
},
{
name: "--test",
description: "Promote test-dependencies to top-level dependencies",
},
{
name: ["--version", "-V"],
description: "Prints version information",
},
],
args: [
{
name: "PACKAGE",
description:
"Limit output to show path to some (indirect) dependency",
debounce: true,
generators: packageList,
},
{
name: "-- INPUT",
isOptional: true,
description: "The elm.json file to solve [default: elm.json]",
generators: filepaths({ extensions: ["json"] }),
},
],
},
{
name: "uninstall",
description: "Uninstall a package",
options: [
{
name: ["--help", "-h"],
description: "Prints help information",
},
{
name: ["--version", "-V"],
description: "Prints version information",
},
{
name: "--yes",
description: 'Answer "yes" to all questions',
},
],
args: [
{
name: "PACKAGE",
description: "Package to uninstall, e.g. elm/html",
debounce: true,
generators: packageList,
},
{
name: "-- INPUT",
isOptional: true,
description: "The elm.json file to upgrade [default: elm.json]",
generators: filepaths({ extensions: ["json"] }),
},
],
},
{
name: "upgrade",
description: "Bring your dependencies up to date",
options: [
{
name: ["--help", "-h"],
description: "Prints help information",
},
{
name: "--unsafe",
description: "Allow major versions bumps",
},
{
name: ["--version", "-V"],
description: "Prints version information",
},
{
name: "--yes",
description: 'Answer "yes" to all questions',
},
],
args: {
name: "INPUT",
description: "The elm.json file to upgrade [default: elm.json]",
isOptional: true,
generators: filepaths({ extensions: ["json"] }),
},
},
],
options: [
{
name: ["--help", "-h"],
description: "Prints help information",
},
{
name: "--offline",
description:
"Enable offline mode, which means no HTTP traffic will happen",
},
{
name: ["--version", "-V"],
description: "Prints version information",
},
{
name: ["--verbose", "-v"],
description: "Sets the level of verbosity",
},
],
};
export default completionSpec;