@chabokan.net/cli 0.8.5 → 0.8.7
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/README.md +33 -13
- package/lib/base.d.ts +1 -1
- package/lib/base.js +25 -26
- package/lib/commands/account/list.d.ts +2 -2
- package/lib/commands/account/list.js +9 -10
- package/lib/commands/account/remove.d.ts +2 -2
- package/lib/commands/account/remove.js +22 -23
- package/lib/commands/account/use.d.ts +3 -3
- package/lib/commands/account/use.js +25 -25
- package/lib/commands/deploy.d.ts +4 -4
- package/lib/commands/deploy.js +77 -67
- package/lib/commands/login.d.ts +5 -5
- package/lib/commands/login.js +24 -22
- package/lib/commands/service/list.d.ts +2 -2
- package/lib/commands/service/list.js +9 -10
- package/lib/commands/service/logs.d.ts +3 -3
- package/lib/commands/service/logs.js +17 -17
- package/lib/commands/service/resize.d.ts +6 -6
- package/lib/commands/service/resize.js +29 -26
- package/lib/commands/service/restart.d.ts +3 -3
- package/lib/commands/service/restart.js +27 -25
- package/lib/commands/service/start.d.ts +3 -3
- package/lib/commands/service/start.js +19 -19
- package/lib/commands/service/stop.d.ts +3 -3
- package/lib/commands/service/stop.js +19 -19
- package/lib/constants.js +5 -9
- package/lib/helper.js +35 -47
- package/lib/index.js +1 -5
- package/oclif.manifest.json +276 -154
- package/package.json +39 -38
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ $ npm install -g @chabokan.net/cli
|
|
|
18
18
|
$ chabok COMMAND
|
|
19
19
|
running command...
|
|
20
20
|
$ chabok (--version|-v)
|
|
21
|
-
@chabokan.net/cli/0.8.
|
|
21
|
+
@chabokan.net/cli/0.8.7 darwin-arm64 node-v20.13.1
|
|
22
22
|
$ chabok --help [COMMAND]
|
|
23
23
|
USAGE
|
|
24
24
|
$ chabok COMMAND
|
|
@@ -32,7 +32,7 @@ USAGE
|
|
|
32
32
|
* [`chabok account use`](#chabok-account-use)
|
|
33
33
|
* [`chabok autocomplete [SHELL]`](#chabok-autocomplete-shell)
|
|
34
34
|
* [`chabok deploy`](#chabok-deploy)
|
|
35
|
-
* [`chabok help [
|
|
35
|
+
* [`chabok help [COMMAND]`](#chabok-help-command)
|
|
36
36
|
* [`chabok login`](#chabok-login)
|
|
37
37
|
* [`chabok service list`](#chabok-service-list)
|
|
38
38
|
* [`chabok service logs`](#chabok-service-logs)
|
|
@@ -57,6 +57,8 @@ DESCRIPTION
|
|
|
57
57
|
show accounts list
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
+
_See code: [src/commands/account/list.ts](https://github.com/chabokan/cli/blob/v0.8.7/src/commands/account/list.ts)_
|
|
61
|
+
|
|
60
62
|
## `chabok account remove`
|
|
61
63
|
|
|
62
64
|
remove account from list
|
|
@@ -72,6 +74,8 @@ DESCRIPTION
|
|
|
72
74
|
remove account from list
|
|
73
75
|
```
|
|
74
76
|
|
|
77
|
+
_See code: [src/commands/account/remove.ts](https://github.com/chabokan/cli/blob/v0.8.7/src/commands/account/remove.ts)_
|
|
78
|
+
|
|
75
79
|
## `chabok account use`
|
|
76
80
|
|
|
77
81
|
switch your default user between logged in users
|
|
@@ -88,22 +92,24 @@ DESCRIPTION
|
|
|
88
92
|
switch your default user between logged in users
|
|
89
93
|
```
|
|
90
94
|
|
|
95
|
+
_See code: [src/commands/account/use.ts](https://github.com/chabokan/cli/blob/v0.8.7/src/commands/account/use.ts)_
|
|
96
|
+
|
|
91
97
|
## `chabok autocomplete [SHELL]`
|
|
92
98
|
|
|
93
|
-
|
|
99
|
+
Display autocomplete installation instructions.
|
|
94
100
|
|
|
95
101
|
```
|
|
96
102
|
USAGE
|
|
97
103
|
$ chabok autocomplete [SHELL] [-r]
|
|
98
104
|
|
|
99
105
|
ARGUMENTS
|
|
100
|
-
SHELL
|
|
106
|
+
SHELL (zsh|bash|powershell) Shell type
|
|
101
107
|
|
|
102
108
|
FLAGS
|
|
103
109
|
-r, --refresh-cache Refresh cache (ignores displaying instructions)
|
|
104
110
|
|
|
105
111
|
DESCRIPTION
|
|
106
|
-
|
|
112
|
+
Display autocomplete installation instructions.
|
|
107
113
|
|
|
108
114
|
EXAMPLES
|
|
109
115
|
$ chabok autocomplete
|
|
@@ -112,10 +118,12 @@ EXAMPLES
|
|
|
112
118
|
|
|
113
119
|
$ chabok autocomplete zsh
|
|
114
120
|
|
|
121
|
+
$ chabok autocomplete powershell
|
|
122
|
+
|
|
115
123
|
$ chabok autocomplete --refresh-cache
|
|
116
124
|
```
|
|
117
125
|
|
|
118
|
-
_See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/
|
|
126
|
+
_See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v3.0.18/src/commands/autocomplete/index.ts)_
|
|
119
127
|
|
|
120
128
|
## `chabok deploy`
|
|
121
129
|
|
|
@@ -134,18 +142,18 @@ DESCRIPTION
|
|
|
134
142
|
this command help you build and deploy your service to chabokan in easy way.
|
|
135
143
|
```
|
|
136
144
|
|
|
137
|
-
_See code: [src/commands/deploy.ts](https://github.com/chabokan/cli/blob/v0.8.
|
|
145
|
+
_See code: [src/commands/deploy.ts](https://github.com/chabokan/cli/blob/v0.8.7/src/commands/deploy.ts)_
|
|
138
146
|
|
|
139
|
-
## `chabok help [
|
|
147
|
+
## `chabok help [COMMAND]`
|
|
140
148
|
|
|
141
149
|
Display help for chabok.
|
|
142
150
|
|
|
143
151
|
```
|
|
144
152
|
USAGE
|
|
145
|
-
$ chabok help [
|
|
153
|
+
$ chabok help [COMMAND...] [-n]
|
|
146
154
|
|
|
147
155
|
ARGUMENTS
|
|
148
|
-
|
|
156
|
+
COMMAND... Command to show help for.
|
|
149
157
|
|
|
150
158
|
FLAGS
|
|
151
159
|
-n, --nested-commands Include all nested commands in the output.
|
|
@@ -154,7 +162,7 @@ DESCRIPTION
|
|
|
154
162
|
Display help for chabok.
|
|
155
163
|
```
|
|
156
164
|
|
|
157
|
-
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/
|
|
165
|
+
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.0.22/src/commands/help.ts)_
|
|
158
166
|
|
|
159
167
|
## `chabok login`
|
|
160
168
|
|
|
@@ -174,7 +182,7 @@ DESCRIPTION
|
|
|
174
182
|
login to hub.chabokan.net account
|
|
175
183
|
```
|
|
176
184
|
|
|
177
|
-
_See code: [src/commands/login.ts](https://github.com/chabokan/cli/blob/v0.8.
|
|
185
|
+
_See code: [src/commands/login.ts](https://github.com/chabokan/cli/blob/v0.8.7/src/commands/login.ts)_
|
|
178
186
|
|
|
179
187
|
## `chabok service list`
|
|
180
188
|
|
|
@@ -191,6 +199,8 @@ DESCRIPTION
|
|
|
191
199
|
show account services list
|
|
192
200
|
```
|
|
193
201
|
|
|
202
|
+
_See code: [src/commands/service/list.ts](https://github.com/chabokan/cli/blob/v0.8.7/src/commands/service/list.ts)_
|
|
203
|
+
|
|
194
204
|
## `chabok service logs`
|
|
195
205
|
|
|
196
206
|
read latest logs from service
|
|
@@ -207,6 +217,8 @@ DESCRIPTION
|
|
|
207
217
|
read latest logs from service
|
|
208
218
|
```
|
|
209
219
|
|
|
220
|
+
_See code: [src/commands/service/logs.ts](https://github.com/chabokan/cli/blob/v0.8.7/src/commands/service/logs.ts)_
|
|
221
|
+
|
|
210
222
|
## `chabok service resize`
|
|
211
223
|
|
|
212
224
|
resize a service
|
|
@@ -226,6 +238,8 @@ DESCRIPTION
|
|
|
226
238
|
resize a service
|
|
227
239
|
```
|
|
228
240
|
|
|
241
|
+
_See code: [src/commands/service/resize.ts](https://github.com/chabokan/cli/blob/v0.8.7/src/commands/service/resize.ts)_
|
|
242
|
+
|
|
229
243
|
## `chabok service restart`
|
|
230
244
|
|
|
231
245
|
restart a service
|
|
@@ -242,6 +256,8 @@ DESCRIPTION
|
|
|
242
256
|
restart a service
|
|
243
257
|
```
|
|
244
258
|
|
|
259
|
+
_See code: [src/commands/service/restart.ts](https://github.com/chabokan/cli/blob/v0.8.7/src/commands/service/restart.ts)_
|
|
260
|
+
|
|
245
261
|
## `chabok service start`
|
|
246
262
|
|
|
247
263
|
start a service
|
|
@@ -258,6 +274,8 @@ DESCRIPTION
|
|
|
258
274
|
start a service
|
|
259
275
|
```
|
|
260
276
|
|
|
277
|
+
_See code: [src/commands/service/start.ts](https://github.com/chabokan/cli/blob/v0.8.7/src/commands/service/start.ts)_
|
|
278
|
+
|
|
261
279
|
## `chabok service stop`
|
|
262
280
|
|
|
263
281
|
stop a service
|
|
@@ -274,6 +292,8 @@ DESCRIPTION
|
|
|
274
292
|
stop a service
|
|
275
293
|
```
|
|
276
294
|
|
|
295
|
+
_See code: [src/commands/service/stop.ts](https://github.com/chabokan/cli/blob/v0.8.7/src/commands/service/stop.ts)_
|
|
296
|
+
|
|
277
297
|
## `chabok version`
|
|
278
298
|
|
|
279
299
|
```
|
|
@@ -292,5 +312,5 @@ FLAG DESCRIPTIONS
|
|
|
292
312
|
Additionally shows the architecture, node version, operating system, and versions of plugins that the CLI is using.
|
|
293
313
|
```
|
|
294
314
|
|
|
295
|
-
_See code: [@oclif/plugin-version](https://github.com/oclif/plugin-version/blob/
|
|
315
|
+
_See code: [@oclif/plugin-version](https://github.com/oclif/plugin-version/blob/v2.1.2/src/commands/version.ts)_
|
|
296
316
|
<!-- commandsstop -->
|
package/lib/base.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Command } from '@oclif/core';
|
|
2
2
|
export default abstract class extends Command {
|
|
3
3
|
static flags: {
|
|
4
|
-
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
4
|
+
help: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<void>;
|
|
5
5
|
};
|
|
6
6
|
axiosConfig: any;
|
|
7
7
|
got: import("got").Got;
|
package/lib/base.js
CHANGED
|
@@ -1,53 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const got_1 = tslib_1.__importDefault(require("got"));
|
|
11
|
-
const https = tslib_1.__importStar(require("https"));
|
|
12
|
-
class default_1 extends core_1.Command {
|
|
1
|
+
import { Command, Flags } from '@oclif/core';
|
|
2
|
+
import axios from 'axios';
|
|
3
|
+
import { BASE_API_URL, GLOBAL_CONF_PATH } from './constants.js';
|
|
4
|
+
import { checkUpdate, get_all_services, isEmptyObject, read_config_file } from './helper.js';
|
|
5
|
+
import HttpsProxyAgent from 'https-proxy-agent';
|
|
6
|
+
import * as fs from 'fs';
|
|
7
|
+
import got from 'got';
|
|
8
|
+
import * as https from 'https';
|
|
9
|
+
class default_1 extends Command {
|
|
13
10
|
constructor() {
|
|
14
11
|
super(...arguments);
|
|
15
|
-
this.axiosConfig =
|
|
16
|
-
|
|
12
|
+
this.axiosConfig = {
|
|
13
|
+
...axios.defaults
|
|
14
|
+
};
|
|
15
|
+
this.got = got.extend();
|
|
17
16
|
}
|
|
18
17
|
async read_config() {
|
|
19
|
-
return
|
|
18
|
+
return read_config_file();
|
|
20
19
|
}
|
|
21
20
|
async write_config(object) {
|
|
22
|
-
fs.writeFileSync(
|
|
21
|
+
fs.writeFileSync(GLOBAL_CONF_PATH, JSON.stringify(object));
|
|
23
22
|
}
|
|
24
23
|
async get_services(filter = {}) {
|
|
25
|
-
return await
|
|
24
|
+
return await get_all_services(filter, this.axiosConfig);
|
|
26
25
|
}
|
|
27
26
|
async init_run() {
|
|
28
|
-
await
|
|
27
|
+
await checkUpdate(this.config.version);
|
|
29
28
|
const main_agent = new https.Agent({
|
|
30
29
|
rejectUnauthorized: false
|
|
31
30
|
});
|
|
32
31
|
// @ts-ignore
|
|
33
32
|
const gotConfig = {};
|
|
34
33
|
this.axiosConfig.httpsAgent = main_agent;
|
|
35
|
-
this.axiosConfig.baseURL =
|
|
34
|
+
this.axiosConfig.baseURL = BASE_API_URL;
|
|
36
35
|
gotConfig.prefixUrl = this.axiosConfig.baseURL;
|
|
37
36
|
gotConfig.agent = { https: main_agent };
|
|
38
37
|
const proxy = process.env.http_proxy || process.env.https_proxy;
|
|
39
38
|
if (proxy) {
|
|
40
39
|
this.log(`Using proxy server ${proxy}`);
|
|
41
40
|
// @ts-ignore
|
|
42
|
-
const agent = new
|
|
41
|
+
const agent = new HttpsProxyAgent(proxy);
|
|
43
42
|
this.axiosConfig.httpsAgent = agent;
|
|
44
43
|
this.axiosConfig.proxy = false;
|
|
45
44
|
// @ts-ignore
|
|
46
45
|
gotConfig.agent = { https: agent };
|
|
47
46
|
}
|
|
48
|
-
const config_json =
|
|
49
|
-
this.got =
|
|
50
|
-
if (
|
|
47
|
+
const config_json = read_config_file();
|
|
48
|
+
this.got = got.extend(gotConfig);
|
|
49
|
+
if (isEmptyObject(config_json) || isEmptyObject(config_json.users)) {
|
|
51
50
|
return;
|
|
52
51
|
}
|
|
53
52
|
// @ts-ignore
|
|
@@ -56,10 +55,10 @@ class default_1 extends core_1.Command {
|
|
|
56
55
|
this.axiosConfig.headers.Authorization = `Token ${token}`;
|
|
57
56
|
gotConfig.headers = { Authorization: `Token ${token}` };
|
|
58
57
|
}
|
|
59
|
-
this.got =
|
|
58
|
+
this.got = got.extend(gotConfig);
|
|
60
59
|
}
|
|
61
60
|
}
|
|
62
|
-
exports.default = default_1;
|
|
63
61
|
default_1.flags = {
|
|
64
|
-
help:
|
|
62
|
+
help: Flags.help({ char: 'h' }),
|
|
65
63
|
};
|
|
64
|
+
export default default_1;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import Command from "../../base";
|
|
1
|
+
import Command from "../../base.js";
|
|
2
2
|
export default class AccountList extends Command {
|
|
3
3
|
static description: string;
|
|
4
4
|
static flags: {
|
|
5
|
-
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
5
|
+
help: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<void>;
|
|
6
6
|
};
|
|
7
7
|
run(): Promise<void>;
|
|
8
8
|
}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const base_1 = tslib_1.__importDefault(require("../../base"));
|
|
5
|
-
const core_1 = require("@oclif/core");
|
|
6
|
-
class AccountList extends base_1.default {
|
|
1
|
+
import Command from "../../base.js";
|
|
2
|
+
import { ux } from "@oclif/core";
|
|
3
|
+
class AccountList extends Command {
|
|
7
4
|
async run() {
|
|
8
5
|
const { args, flags } = await this.parse(AccountList);
|
|
9
6
|
const cli = this;
|
|
@@ -15,7 +12,7 @@ class AccountList extends base_1.default {
|
|
|
15
12
|
Name: account,
|
|
16
13
|
};
|
|
17
14
|
});
|
|
18
|
-
|
|
15
|
+
ux.table(accounts_data, {
|
|
19
16
|
Name: {},
|
|
20
17
|
}, flags);
|
|
21
18
|
}
|
|
@@ -25,6 +22,8 @@ class AccountList extends base_1.default {
|
|
|
25
22
|
}
|
|
26
23
|
}
|
|
27
24
|
}
|
|
28
|
-
|
|
29
|
-
AccountList.
|
|
30
|
-
|
|
25
|
+
AccountList.description = "show accounts list";
|
|
26
|
+
AccountList.flags = {
|
|
27
|
+
...Command.flags,
|
|
28
|
+
};
|
|
29
|
+
export default AccountList;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import Command from "../../base";
|
|
1
|
+
import Command from "../../base.js";
|
|
2
2
|
export default class AccountRemove extends Command {
|
|
3
3
|
static description: string;
|
|
4
4
|
static flags: {
|
|
5
|
-
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
5
|
+
help: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<void>;
|
|
6
6
|
};
|
|
7
7
|
run(): Promise<void>;
|
|
8
8
|
}
|
|
@@ -1,36 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const constants_1 = require("../../constants");
|
|
9
|
-
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
10
|
-
class AccountRemove extends base_1.default {
|
|
1
|
+
import inquirer from "inquirer";
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
import { isEmptyObject, read_config_file } from "../../helper.js";
|
|
4
|
+
import Command from "../../base.js";
|
|
5
|
+
import { GLOBAL_CONF_PATH } from "../../constants.js";
|
|
6
|
+
import fs from "fs";
|
|
7
|
+
class AccountRemove extends Command {
|
|
11
8
|
async run() {
|
|
12
9
|
const cli = this;
|
|
13
10
|
const { args, flags } = await this.parse(AccountRemove);
|
|
14
|
-
const config_json =
|
|
15
|
-
if (
|
|
16
|
-
cli.log(`${
|
|
11
|
+
const config_json = read_config_file();
|
|
12
|
+
if (isEmptyObject(config_json.users)) {
|
|
13
|
+
cli.log(`${chalk.red("[Error]")} first you should login!`);
|
|
17
14
|
return;
|
|
18
15
|
}
|
|
19
|
-
let { user } = await
|
|
20
|
-
type:
|
|
21
|
-
message:
|
|
22
|
-
name:
|
|
23
|
-
choices: Object.keys(config_json.users)
|
|
16
|
+
let { user } = await inquirer.prompt({
|
|
17
|
+
type: "list",
|
|
18
|
+
message: "Please select a user:",
|
|
19
|
+
name: "user",
|
|
20
|
+
choices: Object.keys(config_json.users),
|
|
24
21
|
});
|
|
25
22
|
// @ts-ignore
|
|
26
23
|
delete config_json.users[user];
|
|
27
24
|
if (config_json["default_user"] == user) {
|
|
28
25
|
config_json["default_user"] = "";
|
|
29
26
|
}
|
|
30
|
-
|
|
31
|
-
cli.log(`${
|
|
27
|
+
fs.writeFileSync(GLOBAL_CONF_PATH, JSON.stringify(config_json));
|
|
28
|
+
cli.log(`${chalk.green("[Success]")} user deleted successfully.`);
|
|
32
29
|
}
|
|
33
30
|
}
|
|
34
|
-
|
|
35
|
-
AccountRemove.
|
|
36
|
-
|
|
31
|
+
AccountRemove.description = "remove account from list";
|
|
32
|
+
AccountRemove.flags = {
|
|
33
|
+
...Command.flags,
|
|
34
|
+
};
|
|
35
|
+
export default AccountRemove;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import Command from "../../base";
|
|
1
|
+
import Command from "../../base.js";
|
|
2
2
|
export default class AccountUse extends Command {
|
|
3
3
|
static description: string;
|
|
4
4
|
static flags: {
|
|
5
|
-
user: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
6
|
-
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
5
|
+
user: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
6
|
+
help: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<void>;
|
|
7
7
|
};
|
|
8
8
|
run(): Promise<void>;
|
|
9
9
|
}
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const base_1 = tslib_1.__importDefault(require("../../base"));
|
|
10
|
-
const constants_1 = require("../../constants");
|
|
11
|
-
class AccountUse extends base_1.default {
|
|
1
|
+
import { Flags } from "@oclif/core";
|
|
2
|
+
import inquirer from "inquirer";
|
|
3
|
+
import * as fs from "fs";
|
|
4
|
+
import chalk from "chalk";
|
|
5
|
+
import { isEmptyObject, read_config_file } from "../../helper.js";
|
|
6
|
+
import Command from "../../base.js";
|
|
7
|
+
import { GLOBAL_CONF_PATH } from "../../constants.js";
|
|
8
|
+
class AccountUse extends Command {
|
|
12
9
|
async run() {
|
|
13
10
|
const cli = this;
|
|
14
11
|
const { args, flags } = await this.parse(AccountUse);
|
|
15
|
-
const config_json =
|
|
12
|
+
const config_json = read_config_file();
|
|
16
13
|
let default_user = flags.user;
|
|
17
|
-
if (
|
|
18
|
-
cli.log(`${
|
|
14
|
+
if (isEmptyObject(config_json.users)) {
|
|
15
|
+
cli.log(`${chalk.red("[Error]")} first you should login!`);
|
|
19
16
|
return;
|
|
20
17
|
}
|
|
21
18
|
if (!flags.user) {
|
|
22
|
-
let { user } = await
|
|
23
|
-
type:
|
|
24
|
-
message:
|
|
25
|
-
name:
|
|
26
|
-
choices: Object.keys(config_json.users)
|
|
19
|
+
let { user } = await inquirer.prompt({
|
|
20
|
+
type: "list",
|
|
21
|
+
message: "Please select a user:",
|
|
22
|
+
name: "user",
|
|
23
|
+
choices: Object.keys(config_json.users),
|
|
27
24
|
});
|
|
28
25
|
default_user = user;
|
|
29
26
|
}
|
|
30
27
|
if (default_user in config_json.users) {
|
|
31
28
|
config_json["default_user"] = default_user;
|
|
32
|
-
fs.writeFileSync(
|
|
33
|
-
cli.log(`${
|
|
29
|
+
fs.writeFileSync(GLOBAL_CONF_PATH, JSON.stringify(config_json));
|
|
30
|
+
cli.log(`${chalk.green("[Success]")} user changed successfully.`);
|
|
34
31
|
}
|
|
35
32
|
else {
|
|
36
|
-
cli.log(`${
|
|
33
|
+
cli.log(`${chalk.red("[Error]")} selected user not exist!`);
|
|
37
34
|
}
|
|
38
35
|
}
|
|
39
36
|
}
|
|
40
|
-
|
|
41
|
-
AccountUse.
|
|
42
|
-
|
|
37
|
+
AccountUse.description = "switch your default user between logged in users";
|
|
38
|
+
AccountUse.flags = {
|
|
39
|
+
...Command.flags,
|
|
40
|
+
user: Flags.string({ char: "u", description: "default user" }),
|
|
41
|
+
};
|
|
42
|
+
export default AccountUse;
|
package/lib/commands/deploy.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import Command from "../base";
|
|
1
|
+
import Command from "../base.js";
|
|
2
2
|
export default class Deploy extends Command {
|
|
3
3
|
static description: string;
|
|
4
4
|
static flags: {
|
|
5
|
-
path: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
6
|
-
service: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
7
|
-
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
5
|
+
path: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
6
|
+
service: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
7
|
+
help: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<void>;
|
|
8
8
|
};
|
|
9
9
|
run(): Promise<void>;
|
|
10
10
|
prepare_archive(project_path: any): Promise<string>;
|