-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
/
Copy pathsteadybit.ts
175 lines (170 loc) · 4.35 KB
/
steadybit.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
// https://github.com/steadybit/cli
const configCommand: Fig.Subcommand = {
name: "config",
description: "Show/modify the CLI configuration and authentication profiles",
subcommands: [
{
name: "show",
description:
"Show the active CLI configuration. Warning: Prints secrets!",
},
{
name: "profile",
description: "Configure authentication profiles",
subcommands: [
{
name: "add",
description: "Interactively configure a new profile",
},
{
name: ["list", "ls"],
description: "List all configured profiles",
},
{
name: "remove",
description: "Interactively remove an existing profile",
},
{
name: "select",
description: "Interactively change the currently active profile",
},
],
},
],
};
const directoryOptionForTaskAndPolicyFiles: Fig.Option = {
name: ["-d", "--directory"],
description: "The directory to search for task and policy files",
args: {
name: "directory",
template: "folders",
},
};
const defRepoCommand: Fig.Subcommand = {
name: "def-repo",
description:
"Change versions and verify a task/policy definition repository state",
subcommands: [
{
name: "set-version",
description: "Set the versions in policies and task references",
options: [
{
name: ["-v", "--version"],
description: "Version to set",
isRequired: true,
args: {
name: "version",
},
},
directoryOptionForTaskAndPolicyFiles,
],
},
{
name: "check",
description: "Checks that the tasks and policies are valid",
options: [
{
name: ["-v", "--version"],
description: "The version to check",
args: {
name: "version",
},
},
directoryOptionForTaskAndPolicyFiles,
],
},
],
};
const fileOptionForServiceDefinitions: Fig.Option = {
name: ["-f", "--file"],
description: "Path to the service definition file",
args: {
name: "file",
template: "filepaths",
},
};
const serviceCommand: Fig.Subcommand = {
name: ["service", "service-definition"],
description: "Configure or verify service definitions",
subcommands: [
{
name: "apply",
description: "Upload a service definition",
options: [fileOptionForServiceDefinitions],
},
{
name: "delete",
description: "Delete a service definition",
options: [
fileOptionForServiceDefinitions,
{
name: ["-i", "--id"],
description: "ID of the service definition to delete",
args: {
name: "id",
},
},
],
},
{
name: "init",
description: "Initialize a service definition file",
},
{
name: "open",
description: "Open the service in the Steadybit UI",
options: [fileOptionForServiceDefinitions],
},
{
name: "verify",
description: "Read the current service definition and state",
options: [
fileOptionForServiceDefinitions,
{
name: ["-pp", "--print-parameters"],
description: "Print task parameters when listing tasks",
},
{
name: ["-pm", "--print-matrix-context"],
description:
"Print the matrix execution context information when listing tasks",
},
],
},
{
name: "show",
description:
"Show a list of tasks and policies referenced by this service",
options: [
fileOptionForServiceDefinitions,
{
name: ["-n", "--name"],
description: "Optional task name to filter the result list",
args: {
name: "name",
},
},
{
name: ["-v", "--version"],
description: "Optional task version to filter the result list",
args: {
name: "version",
},
},
],
},
],
};
const completionSpec: Fig.Spec = {
name: "steadybit",
description: "Command-line interface to interact with the Steadybit API",
subcommands: [configCommand, defRepoCommand, serviceCommand],
options: [
{
name: ["--help", "-h"],
description: "Display usage information",
},
],
};
export default completionSpec;