@chabokan.net/cli 0.7.7 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +182 -84
- package/bin/dev +17 -0
- package/bin/dev.cmd +3 -0
- package/bin/run +3 -3
- package/lib/base.d.ts +8 -38
- package/lib/base.js +12 -15
- package/lib/commands/account/list.d.ts +8 -0
- package/lib/commands/account/list.js +30 -0
- package/lib/commands/account/remove.d.ts +8 -0
- package/lib/commands/account/remove.js +36 -0
- package/lib/commands/account/use.d.ts +9 -0
- package/lib/commands/{change-user.js → account/use.js} +14 -16
- package/lib/commands/deploy.d.ts +3 -4
- package/lib/commands/deploy.js +17 -17
- package/lib/commands/login.d.ts +7 -5
- package/lib/commands/login.js +12 -11
- package/lib/commands/service/list.d.ts +8 -0
- package/lib/commands/service/list.js +34 -0
- package/lib/commands/service/logs.d.ts +10 -0
- package/lib/commands/{logs.js → service/logs.js} +13 -13
- package/lib/commands/service/resize.d.ts +13 -0
- package/lib/commands/{resize.js → service/resize.js} +15 -15
- package/lib/commands/service/restart.d.ts +10 -0
- package/lib/commands/{restart.js → service/restart.js} +12 -12
- package/lib/commands/service/start.d.ts +10 -0
- package/lib/commands/{start.js → service/start.js} +12 -12
- package/lib/commands/service/stop.d.ts +10 -0
- package/lib/commands/{stop.js → service/stop.js} +12 -12
- package/lib/constants.d.ts +1 -1
- package/lib/constants.js +1 -1
- package/lib/helper.d.ts +2 -2
- package/lib/helper.js +11 -10
- package/lib/index.d.ts +1 -1
- package/lib/index.js +3 -2
- package/oclif.manifest.json +1 -1
- package/package.json +83 -59
- package/lib/commands/change-user.d.ts +0 -9
- package/lib/commands/config-clear.d.ts +0 -8
- package/lib/commands/config-clear.js +0 -17
- package/lib/commands/logs.d.ts +0 -11
- package/lib/commands/resize.d.ts +0 -14
- package/lib/commands/restart.d.ts +0 -11
- package/lib/commands/start.d.ts +0 -11
- package/lib/commands/stop.d.ts +0 -11
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 Salesforce
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
chabok CLI
|
|
2
2
|
=================
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
The command line interface for chabokan.net
|
|
5
5
|
|
|
6
|
-
[](https://npmjs.org/package/@chabokan.net/cli)
|
|
6
|
+
[](https://npmjs.com/package/@chabokan.net/cli)
|
|
8
7
|
[](https://npmjs.org/package/@chabokan.net/cli)
|
|
9
8
|
[](https://github.com/chabokan/cli/blob/master/package.json)
|
|
10
9
|
|
|
@@ -18,8 +17,8 @@ Chabokan Cli for PaaS Services
|
|
|
18
17
|
$ npm install -g @chabokan.net/cli
|
|
19
18
|
$ chabok COMMAND
|
|
20
19
|
running command...
|
|
21
|
-
$ chabok (
|
|
22
|
-
@chabokan.net/cli/0.
|
|
20
|
+
$ chabok (--version|-v)
|
|
21
|
+
@chabokan.net/cli/0.8.1 darwin-x64 node-v14.5.0
|
|
23
22
|
$ chabok --help [COMMAND]
|
|
24
23
|
USAGE
|
|
25
24
|
$ chabok COMMAND
|
|
@@ -28,45 +27,95 @@ USAGE
|
|
|
28
27
|
<!-- usagestop -->
|
|
29
28
|
# Commands
|
|
30
29
|
<!-- commands -->
|
|
31
|
-
* [`chabok
|
|
32
|
-
* [`chabok
|
|
30
|
+
* [`chabok account list`](#chabok-account-list)
|
|
31
|
+
* [`chabok account remove`](#chabok-account-remove)
|
|
32
|
+
* [`chabok account use`](#chabok-account-use)
|
|
33
|
+
* [`chabok autocomplete [SHELL]`](#chabok-autocomplete-shell)
|
|
33
34
|
* [`chabok deploy`](#chabok-deploy)
|
|
34
35
|
* [`chabok help [COMMAND]`](#chabok-help-command)
|
|
35
|
-
* [`chabok login`](#chabok-login)
|
|
36
|
-
* [`chabok
|
|
37
|
-
* [`chabok
|
|
38
|
-
* [`chabok
|
|
39
|
-
* [`chabok
|
|
40
|
-
* [`chabok
|
|
36
|
+
* [`chabok login [FILE]`](#chabok-login-file)
|
|
37
|
+
* [`chabok service list`](#chabok-service-list)
|
|
38
|
+
* [`chabok service logs`](#chabok-service-logs)
|
|
39
|
+
* [`chabok service resize`](#chabok-service-resize)
|
|
40
|
+
* [`chabok service restart`](#chabok-service-restart)
|
|
41
|
+
* [`chabok service start`](#chabok-service-start)
|
|
42
|
+
* [`chabok service stop`](#chabok-service-stop)
|
|
43
|
+
* [`chabok version`](#chabok-version)
|
|
41
44
|
|
|
42
|
-
## `chabok
|
|
45
|
+
## `chabok account list`
|
|
43
46
|
|
|
44
|
-
|
|
47
|
+
show accounts list
|
|
45
48
|
|
|
46
49
|
```
|
|
47
50
|
USAGE
|
|
48
|
-
$ chabok
|
|
51
|
+
$ chabok account list [-h]
|
|
52
|
+
|
|
53
|
+
FLAGS
|
|
54
|
+
-h, --help Show CLI help.
|
|
49
55
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
-u, --user=user default user
|
|
56
|
+
DESCRIPTION
|
|
57
|
+
show accounts list
|
|
53
58
|
```
|
|
54
59
|
|
|
55
|
-
|
|
60
|
+
## `chabok account remove`
|
|
61
|
+
|
|
62
|
+
remove account from list
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
USAGE
|
|
66
|
+
$ chabok account remove [-h]
|
|
67
|
+
|
|
68
|
+
FLAGS
|
|
69
|
+
-h, --help Show CLI help.
|
|
56
70
|
|
|
57
|
-
|
|
71
|
+
DESCRIPTION
|
|
72
|
+
remove account from list
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## `chabok account use`
|
|
58
76
|
|
|
59
|
-
|
|
77
|
+
switch your default user between logged in users
|
|
60
78
|
|
|
61
79
|
```
|
|
62
80
|
USAGE
|
|
63
|
-
$ chabok
|
|
81
|
+
$ chabok account use [-h] [-u <value>]
|
|
82
|
+
|
|
83
|
+
FLAGS
|
|
84
|
+
-h, --help Show CLI help.
|
|
85
|
+
-u, --user=<value> default user
|
|
64
86
|
|
|
65
|
-
|
|
66
|
-
|
|
87
|
+
DESCRIPTION
|
|
88
|
+
switch your default user between logged in users
|
|
67
89
|
```
|
|
68
90
|
|
|
69
|
-
|
|
91
|
+
## `chabok autocomplete [SHELL]`
|
|
92
|
+
|
|
93
|
+
display autocomplete installation instructions
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
USAGE
|
|
97
|
+
$ chabok autocomplete [SHELL] [-r]
|
|
98
|
+
|
|
99
|
+
ARGUMENTS
|
|
100
|
+
SHELL shell type
|
|
101
|
+
|
|
102
|
+
FLAGS
|
|
103
|
+
-r, --refresh-cache Refresh cache (ignores displaying instructions)
|
|
104
|
+
|
|
105
|
+
DESCRIPTION
|
|
106
|
+
display autocomplete installation instructions
|
|
107
|
+
|
|
108
|
+
EXAMPLES
|
|
109
|
+
$ chabok autocomplete
|
|
110
|
+
|
|
111
|
+
$ chabok autocomplete bash
|
|
112
|
+
|
|
113
|
+
$ chabok autocomplete zsh
|
|
114
|
+
|
|
115
|
+
$ chabok autocomplete --refresh-cache
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
_See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v1.3.3/src/commands/autocomplete/index.ts)_
|
|
70
119
|
|
|
71
120
|
## `chabok deploy`
|
|
72
121
|
|
|
@@ -74,125 +123,174 @@ this command help you build and deploy your service to chabokan in easy way.
|
|
|
74
123
|
|
|
75
124
|
```
|
|
76
125
|
USAGE
|
|
77
|
-
$ chabok deploy
|
|
126
|
+
$ chabok deploy [-h] [-p <value>] [-s <value>]
|
|
127
|
+
|
|
128
|
+
FLAGS
|
|
129
|
+
-h, --help Show CLI help.
|
|
130
|
+
-p, --path=<value> service path in your computer
|
|
131
|
+
-s, --service=<value> service name
|
|
78
132
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
-p, --path=path service path in your computer
|
|
82
|
-
-s, --service=service service name
|
|
133
|
+
DESCRIPTION
|
|
134
|
+
this command help you build and deploy your service to chabokan in easy way.
|
|
83
135
|
```
|
|
84
136
|
|
|
85
|
-
_See code: [src/commands/deploy.ts](https://github.com/chabokan/cli/blob/v0.
|
|
137
|
+
_See code: [src/commands/deploy.ts](https://github.com/chabokan/cli/blob/v0.8.1/src/commands/deploy.ts)_
|
|
86
138
|
|
|
87
139
|
## `chabok help [COMMAND]`
|
|
88
140
|
|
|
89
|
-
|
|
141
|
+
Display help for chabok.
|
|
90
142
|
|
|
91
143
|
```
|
|
92
144
|
USAGE
|
|
93
|
-
$ chabok help [COMMAND]
|
|
145
|
+
$ chabok help [COMMAND] [-n]
|
|
94
146
|
|
|
95
147
|
ARGUMENTS
|
|
96
|
-
COMMAND
|
|
148
|
+
COMMAND Command to show help for.
|
|
149
|
+
|
|
150
|
+
FLAGS
|
|
151
|
+
-n, --nested-commands Include all nested commands in the output.
|
|
97
152
|
|
|
98
|
-
|
|
99
|
-
|
|
153
|
+
DESCRIPTION
|
|
154
|
+
Display help for chabok.
|
|
100
155
|
```
|
|
101
156
|
|
|
102
|
-
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/
|
|
157
|
+
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v5.1.15/src/commands/help.ts)_
|
|
103
158
|
|
|
104
|
-
## `chabok login`
|
|
159
|
+
## `chabok login [FILE]`
|
|
105
160
|
|
|
106
161
|
login to hub.chabokan.net account
|
|
107
162
|
|
|
108
163
|
```
|
|
109
164
|
USAGE
|
|
110
|
-
$ chabok login
|
|
165
|
+
$ chabok login [FILE] [-h] [-u <value>] [-p <value>] [-t <value>]
|
|
111
166
|
|
|
112
|
-
|
|
113
|
-
-h, --help
|
|
114
|
-
-p, --password
|
|
115
|
-
-t, --token
|
|
116
|
-
-u, --username
|
|
167
|
+
FLAGS
|
|
168
|
+
-h, --help Show CLI help.
|
|
169
|
+
-p, --password=<value> your password
|
|
170
|
+
-t, --token=<value> login with api token
|
|
171
|
+
-u, --username=<value> your username
|
|
172
|
+
|
|
173
|
+
DESCRIPTION
|
|
174
|
+
login to hub.chabokan.net account
|
|
117
175
|
```
|
|
118
176
|
|
|
119
|
-
_See code: [src/commands/login.ts](https://github.com/chabokan/cli/blob/v0.
|
|
177
|
+
_See code: [src/commands/login.ts](https://github.com/chabokan/cli/blob/v0.8.1/src/commands/login.ts)_
|
|
120
178
|
|
|
121
|
-
## `chabok
|
|
179
|
+
## `chabok service list`
|
|
122
180
|
|
|
123
|
-
|
|
181
|
+
show account services list
|
|
124
182
|
|
|
125
183
|
```
|
|
126
184
|
USAGE
|
|
127
|
-
$ chabok
|
|
185
|
+
$ chabok service list [-h]
|
|
186
|
+
|
|
187
|
+
FLAGS
|
|
188
|
+
-h, --help Show CLI help.
|
|
189
|
+
|
|
190
|
+
DESCRIPTION
|
|
191
|
+
show account services list
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## `chabok service logs`
|
|
195
|
+
|
|
196
|
+
read latest logs from service
|
|
128
197
|
|
|
129
|
-
OPTIONS
|
|
130
|
-
-h, --help show CLI help
|
|
131
|
-
-s, --service=service service name
|
|
132
198
|
```
|
|
199
|
+
USAGE
|
|
200
|
+
$ chabok service logs [-h] [-s <value>]
|
|
133
201
|
|
|
134
|
-
|
|
202
|
+
FLAGS
|
|
203
|
+
-h, --help Show CLI help.
|
|
204
|
+
-s, --service=<value> service name
|
|
205
|
+
|
|
206
|
+
DESCRIPTION
|
|
207
|
+
read latest logs from service
|
|
208
|
+
```
|
|
135
209
|
|
|
136
|
-
## `chabok resize`
|
|
210
|
+
## `chabok service resize`
|
|
137
211
|
|
|
138
212
|
resize a service
|
|
139
213
|
|
|
140
214
|
```
|
|
141
215
|
USAGE
|
|
142
|
-
$ chabok resize
|
|
216
|
+
$ chabok service resize [-h] [-s <value>] [-r <value>] [-c <value>] [-d <value>]
|
|
143
217
|
|
|
144
|
-
|
|
145
|
-
-c, --cpu
|
|
146
|
-
-d, --disk
|
|
147
|
-
-h, --help
|
|
148
|
-
-r, --ram
|
|
149
|
-
-s, --service
|
|
150
|
-
```
|
|
218
|
+
FLAGS
|
|
219
|
+
-c, --cpu=<value> CPU
|
|
220
|
+
-d, --disk=<value> DISK
|
|
221
|
+
-h, --help Show CLI help.
|
|
222
|
+
-r, --ram=<value> RAM
|
|
223
|
+
-s, --service=<value> service name
|
|
151
224
|
|
|
152
|
-
|
|
225
|
+
DESCRIPTION
|
|
226
|
+
resize a service
|
|
227
|
+
```
|
|
153
228
|
|
|
154
|
-
## `chabok restart`
|
|
229
|
+
## `chabok service restart`
|
|
155
230
|
|
|
156
231
|
restart a service
|
|
157
232
|
|
|
158
233
|
```
|
|
159
234
|
USAGE
|
|
160
|
-
$ chabok restart
|
|
235
|
+
$ chabok service restart [-h] [-s <value>]
|
|
161
236
|
|
|
162
|
-
|
|
163
|
-
-h, --help
|
|
164
|
-
-s, --service
|
|
165
|
-
```
|
|
237
|
+
FLAGS
|
|
238
|
+
-h, --help Show CLI help.
|
|
239
|
+
-s, --service=<value> service name
|
|
166
240
|
|
|
167
|
-
|
|
241
|
+
DESCRIPTION
|
|
242
|
+
restart a service
|
|
243
|
+
```
|
|
168
244
|
|
|
169
|
-
## `chabok start`
|
|
245
|
+
## `chabok service start`
|
|
170
246
|
|
|
171
247
|
start a service
|
|
172
248
|
|
|
173
249
|
```
|
|
174
250
|
USAGE
|
|
175
|
-
$ chabok start
|
|
251
|
+
$ chabok service start [-h] [-s <value>]
|
|
176
252
|
|
|
177
|
-
|
|
178
|
-
-h, --help
|
|
179
|
-
-s, --service
|
|
180
|
-
```
|
|
253
|
+
FLAGS
|
|
254
|
+
-h, --help Show CLI help.
|
|
255
|
+
-s, --service=<value> service name
|
|
181
256
|
|
|
182
|
-
|
|
257
|
+
DESCRIPTION
|
|
258
|
+
start a service
|
|
259
|
+
```
|
|
183
260
|
|
|
184
|
-
## `chabok stop`
|
|
261
|
+
## `chabok service stop`
|
|
185
262
|
|
|
186
263
|
stop a service
|
|
187
264
|
|
|
188
265
|
```
|
|
189
266
|
USAGE
|
|
190
|
-
$ chabok stop
|
|
267
|
+
$ chabok service stop [-h] [-s <value>]
|
|
268
|
+
|
|
269
|
+
FLAGS
|
|
270
|
+
-h, --help Show CLI help.
|
|
271
|
+
-s, --service=<value> service name
|
|
272
|
+
|
|
273
|
+
DESCRIPTION
|
|
274
|
+
stop a service
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
## `chabok version`
|
|
278
|
+
|
|
279
|
+
```
|
|
280
|
+
USAGE
|
|
281
|
+
$ chabok version [--json] [--verbose]
|
|
282
|
+
|
|
283
|
+
FLAGS
|
|
284
|
+
--verbose Show additional information about the CLI.
|
|
285
|
+
|
|
286
|
+
GLOBAL FLAGS
|
|
287
|
+
--json Format output as json.
|
|
288
|
+
|
|
289
|
+
FLAG DESCRIPTIONS
|
|
290
|
+
--verbose Show additional information about the CLI.
|
|
191
291
|
|
|
192
|
-
|
|
193
|
-
-h, --help show CLI help
|
|
194
|
-
-s, --service=service service name
|
|
292
|
+
Additionally shows the architecture, node version, operating system, and versions of plugins that the CLI is using.
|
|
195
293
|
```
|
|
196
294
|
|
|
197
|
-
_See code: [
|
|
295
|
+
_See code: [@oclif/plugin-version](https://github.com/oclif/plugin-version/blob/v1.1.3/src/commands/version.ts)_
|
|
198
296
|
<!-- commandsstop -->
|
package/bin/dev
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const oclif = require('@oclif/core')
|
|
4
|
+
|
|
5
|
+
const path = require('path')
|
|
6
|
+
const project = path.join(__dirname, '..', 'tsconfig.json')
|
|
7
|
+
|
|
8
|
+
// In dev mode -> use ts-node and dev plugins
|
|
9
|
+
process.env.NODE_ENV = 'development'
|
|
10
|
+
|
|
11
|
+
require('ts-node').register({project})
|
|
12
|
+
|
|
13
|
+
// In dev mode, always show stack traces
|
|
14
|
+
oclif.settings.debug = true;
|
|
15
|
+
|
|
16
|
+
// Start the CLI
|
|
17
|
+
oclif.run().then(oclif.flush).catch(oclif.Errors.handle)
|
package/bin/dev.cmd
ADDED
package/bin/run
CHANGED
package/lib/base.d.ts
CHANGED
|
@@ -1,45 +1,15 @@
|
|
|
1
|
-
import Command from '@oclif/
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
2
|
export default abstract class extends Command {
|
|
3
3
|
static flags: {
|
|
4
|
-
help: import("@oclif/
|
|
4
|
+
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
5
5
|
};
|
|
6
|
-
axiosConfig:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
baseURL?: string | undefined;
|
|
10
|
-
transformRequest?: import("axios").AxiosTransformer | import("axios").AxiosTransformer[] | undefined;
|
|
11
|
-
transformResponse?: import("axios").AxiosTransformer | import("axios").AxiosTransformer[] | undefined;
|
|
12
|
-
headers?: any;
|
|
13
|
-
params?: any;
|
|
14
|
-
paramsSerializer?: ((params: any) => string) | undefined;
|
|
15
|
-
data?: any;
|
|
16
|
-
timeout?: number | undefined;
|
|
17
|
-
timeoutErrorMessage?: string | undefined;
|
|
18
|
-
withCredentials?: boolean | undefined;
|
|
19
|
-
adapter?: import("axios").AxiosAdapter | undefined;
|
|
20
|
-
auth?: import("axios").AxiosBasicCredentials | undefined;
|
|
21
|
-
responseType?: "arraybuffer" | "blob" | "document" | "json" | "text" | "stream" | undefined;
|
|
22
|
-
xsrfCookieName?: string | undefined;
|
|
23
|
-
xsrfHeaderName?: string | undefined;
|
|
24
|
-
onUploadProgress?: ((progressEvent: any) => void) | undefined;
|
|
25
|
-
onDownloadProgress?: ((progressEvent: any) => void) | undefined;
|
|
26
|
-
maxContentLength?: number | undefined;
|
|
27
|
-
validateStatus?: ((status: number) => boolean) | null | undefined;
|
|
28
|
-
maxBodyLength?: number | undefined;
|
|
29
|
-
maxRedirects?: number | undefined;
|
|
30
|
-
socketPath?: string | null | undefined;
|
|
31
|
-
httpAgent?: any;
|
|
32
|
-
httpsAgent?: any;
|
|
33
|
-
proxy?: false | import("axios").AxiosProxyConfig | undefined;
|
|
34
|
-
cancelToken?: import("axios").CancelToken | undefined;
|
|
35
|
-
decompress?: boolean | undefined;
|
|
36
|
-
};
|
|
37
|
-
got: import("got/dist/source").Got;
|
|
38
|
-
read_config(): {
|
|
6
|
+
axiosConfig: any;
|
|
7
|
+
got: import("got").Got;
|
|
8
|
+
read_config(): Promise<{
|
|
39
9
|
users: {};
|
|
40
10
|
default_user: string;
|
|
41
|
-
}
|
|
42
|
-
write_config(object: any): void
|
|
11
|
+
}>;
|
|
12
|
+
write_config(object: any): Promise<void>;
|
|
43
13
|
get_services(filter?: {}): Promise<any>;
|
|
44
|
-
init_run(): void
|
|
14
|
+
init_run(): Promise<void>;
|
|
45
15
|
}
|
package/lib/base.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
5
|
const axios_1 = tslib_1.__importDefault(require("axios"));
|
|
6
6
|
const constants_1 = require("./constants");
|
|
7
7
|
const helper_1 = require("./helper");
|
|
8
|
-
const
|
|
8
|
+
const https_proxy_agent_1 = tslib_1.__importDefault(require("https-proxy-agent"));
|
|
9
9
|
const fs = tslib_1.__importStar(require("fs"));
|
|
10
10
|
const got_1 = tslib_1.__importDefault(require("got"));
|
|
11
11
|
const https = tslib_1.__importStar(require("https"));
|
|
12
|
-
class default_1 extends
|
|
12
|
+
class default_1 extends core_1.Command {
|
|
13
13
|
constructor() {
|
|
14
14
|
super(...arguments);
|
|
15
15
|
this.axiosConfig = Object.assign({}, axios_1.default.defaults);
|
|
16
16
|
this.got = got_1.default.extend();
|
|
17
17
|
}
|
|
18
|
-
read_config() {
|
|
19
|
-
return helper_1.read_config_file();
|
|
18
|
+
async read_config() {
|
|
19
|
+
return (0, helper_1.read_config_file)();
|
|
20
20
|
}
|
|
21
|
-
write_config(object) {
|
|
21
|
+
async write_config(object) {
|
|
22
22
|
fs.writeFileSync(constants_1.GLOBAL_CONF_PATH, JSON.stringify(object));
|
|
23
23
|
}
|
|
24
24
|
async get_services(filter = {}) {
|
|
25
|
-
return await helper_1.get_all_services(filter, this.axiosConfig);
|
|
25
|
+
return await (0, helper_1.get_all_services)(filter, this.axiosConfig);
|
|
26
26
|
}
|
|
27
|
-
init_run() {
|
|
27
|
+
async init_run() {
|
|
28
28
|
const main_agent = new https.Agent({
|
|
29
29
|
rejectUnauthorized: false
|
|
30
30
|
});
|
|
@@ -38,18 +38,15 @@ class default_1 extends command_1.default {
|
|
|
38
38
|
if (proxy) {
|
|
39
39
|
this.log(`Using proxy server ${proxy}`);
|
|
40
40
|
// @ts-ignore
|
|
41
|
-
const agent =
|
|
42
|
-
proxy: proxy,
|
|
43
|
-
rejectUnauthorized: false
|
|
44
|
-
});
|
|
41
|
+
const agent = new https_proxy_agent_1.default(proxy);
|
|
45
42
|
this.axiosConfig.httpsAgent = agent;
|
|
46
43
|
this.axiosConfig.proxy = false;
|
|
47
44
|
// @ts-ignore
|
|
48
45
|
gotConfig.agent = { https: agent };
|
|
49
46
|
}
|
|
50
|
-
const config_json = helper_1.read_config_file();
|
|
47
|
+
const config_json = (0, helper_1.read_config_file)();
|
|
51
48
|
this.got = got_1.default.extend(gotConfig);
|
|
52
|
-
if (helper_1.isEmptyObject(config_json) || helper_1.isEmptyObject(config_json.users)) {
|
|
49
|
+
if ((0, helper_1.isEmptyObject)(config_json) || (0, helper_1.isEmptyObject)(config_json.users)) {
|
|
53
50
|
return;
|
|
54
51
|
}
|
|
55
52
|
// @ts-ignore
|
|
@@ -63,5 +60,5 @@ class default_1 extends command_1.default {
|
|
|
63
60
|
}
|
|
64
61
|
exports.default = default_1;
|
|
65
62
|
default_1.flags = {
|
|
66
|
-
help:
|
|
63
|
+
help: core_1.Flags.help({ char: 'h' }),
|
|
67
64
|
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const base_1 = tslib_1.__importDefault(require("../../base"));
|
|
5
|
+
const core_1 = require("@oclif/core");
|
|
6
|
+
class AccountList extends base_1.default {
|
|
7
|
+
async run() {
|
|
8
|
+
const { args, flags } = await this.parse(AccountList);
|
|
9
|
+
const cli = this;
|
|
10
|
+
await this.init_run();
|
|
11
|
+
const config_json = await this.read_config();
|
|
12
|
+
if (Object.keys(config_json.users).length > 0) {
|
|
13
|
+
const accounts_data = Object.keys(config_json.users).map((account) => {
|
|
14
|
+
return {
|
|
15
|
+
Name: account,
|
|
16
|
+
};
|
|
17
|
+
});
|
|
18
|
+
core_1.CliUx.ux.table(accounts_data, {
|
|
19
|
+
Name: {},
|
|
20
|
+
}, flags);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
cli.log("first you should login");
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.default = AccountList;
|
|
29
|
+
AccountList.description = 'show accounts list';
|
|
30
|
+
AccountList.flags = Object.assign({}, base_1.default.flags);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
|
|
5
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
6
|
+
const helper_1 = require("../../helper");
|
|
7
|
+
const base_1 = tslib_1.__importDefault(require("../../base"));
|
|
8
|
+
const constants_1 = require("../../constants");
|
|
9
|
+
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
10
|
+
class AccountRemove extends base_1.default {
|
|
11
|
+
async run() {
|
|
12
|
+
const cli = this;
|
|
13
|
+
const { args, flags } = await this.parse(AccountRemove);
|
|
14
|
+
const config_json = (0, helper_1.read_config_file)();
|
|
15
|
+
if ((0, helper_1.isEmptyObject)(config_json.users)) {
|
|
16
|
+
cli.log(`${chalk_1.default.red('[Error]')} first you should login!`);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
let { user } = await inquirer_1.default.prompt({
|
|
20
|
+
type: 'list',
|
|
21
|
+
message: 'Please select a user:',
|
|
22
|
+
name: 'user',
|
|
23
|
+
choices: Object.keys(config_json.users)
|
|
24
|
+
});
|
|
25
|
+
// @ts-ignore
|
|
26
|
+
delete config_json.users[user];
|
|
27
|
+
if (config_json["default_user"] == user) {
|
|
28
|
+
config_json["default_user"] = "";
|
|
29
|
+
}
|
|
30
|
+
fs_1.default.writeFileSync(constants_1.GLOBAL_CONF_PATH, JSON.stringify(config_json));
|
|
31
|
+
cli.log(`${chalk_1.default.green('[Success]')} user deleted successfully.`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.default = AccountRemove;
|
|
35
|
+
AccountRemove.description = 'remove account from list';
|
|
36
|
+
AccountRemove.flags = Object.assign({}, base_1.default.flags);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import Command from "../../base";
|
|
2
|
+
export default class AccountUse extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
user: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
6
|
+
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
7
|
+
};
|
|
8
|
+
run(): Promise<void>;
|
|
9
|
+
}
|