@chabokan.net/cli 0.8.9 → 0.8.15
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 +25 -24
- package/dist/base.d.ts +10 -8
- package/dist/base.js +13 -10
- package/dist/commands/account/list.js +24 -15
- package/dist/commands/account/remove.js +12 -8
- package/dist/commands/account/use.js +6 -6
- package/dist/commands/deploy.d.ts +3 -2
- package/dist/commands/deploy.js +115 -70
- package/dist/commands/login.js +51 -31
- package/dist/commands/service/list.js +32 -19
- package/dist/commands/service/logs.d.ts +1 -1
- package/dist/commands/service/logs.js +23 -14
- package/dist/commands/service/resize.d.ts +1 -1
- package/dist/commands/service/resize.js +49 -31
- package/dist/commands/service/restart.d.ts +1 -1
- package/dist/commands/service/restart.js +28 -15
- package/dist/commands/service/start.d.ts +1 -1
- package/dist/commands/service/start.js +28 -15
- package/dist/commands/service/stop.d.ts +1 -1
- package/dist/commands/service/stop.js +28 -15
- package/dist/helper.d.ts +15 -8
- package/dist/helper.js +234 -38
- package/dist/types.d.ts +57 -0
- package/dist/types.js +2 -0
- package/oclif.manifest.json +1 -1
- package/package.json +106 -106
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ $ npm install -g @chabokan.net/cli
|
|
|
20
20
|
$ chabok COMMAND
|
|
21
21
|
running command...
|
|
22
22
|
$ chabok (--version|-v)
|
|
23
|
-
@chabokan.net/cli/0.8.
|
|
23
|
+
@chabokan.net/cli/0.8.15 darwin-arm64 node-v20.13.1
|
|
24
24
|
$ chabok --help [COMMAND]
|
|
25
25
|
USAGE
|
|
26
26
|
$ chabok COMMAND
|
|
@@ -69,7 +69,7 @@ DESCRIPTION
|
|
|
69
69
|
show accounts list
|
|
70
70
|
```
|
|
71
71
|
|
|
72
|
-
_See code: [src/commands/account/list.ts](https://github.com/chabokan/cli/blob/v0.8.
|
|
72
|
+
_See code: [src/commands/account/list.ts](https://github.com/chabokan/cli/blob/v0.8.15/src/commands/account/list.ts)_
|
|
73
73
|
|
|
74
74
|
## `chabok account remove`
|
|
75
75
|
|
|
@@ -86,7 +86,7 @@ DESCRIPTION
|
|
|
86
86
|
remove account from list
|
|
87
87
|
```
|
|
88
88
|
|
|
89
|
-
_See code: [src/commands/account/remove.ts](https://github.com/chabokan/cli/blob/v0.8.
|
|
89
|
+
_See code: [src/commands/account/remove.ts](https://github.com/chabokan/cli/blob/v0.8.15/src/commands/account/remove.ts)_
|
|
90
90
|
|
|
91
91
|
## `chabok account use`
|
|
92
92
|
|
|
@@ -104,7 +104,7 @@ DESCRIPTION
|
|
|
104
104
|
switch your default user between logged in users
|
|
105
105
|
```
|
|
106
106
|
|
|
107
|
-
_See code: [src/commands/account/use.ts](https://github.com/chabokan/cli/blob/v0.8.
|
|
107
|
+
_See code: [src/commands/account/use.ts](https://github.com/chabokan/cli/blob/v0.8.15/src/commands/account/use.ts)_
|
|
108
108
|
|
|
109
109
|
## `chabok autocomplete [SHELL]`
|
|
110
110
|
|
|
@@ -135,7 +135,7 @@ EXAMPLES
|
|
|
135
135
|
$ chabok autocomplete --refresh-cache
|
|
136
136
|
```
|
|
137
137
|
|
|
138
|
-
_See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v3.
|
|
138
|
+
_See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v3.2.31/src/commands/autocomplete/index.ts)_
|
|
139
139
|
|
|
140
140
|
## `chabok deploy`
|
|
141
141
|
|
|
@@ -154,7 +154,7 @@ DESCRIPTION
|
|
|
154
154
|
this command help you build and deploy your service to chabokan in easy way.
|
|
155
155
|
```
|
|
156
156
|
|
|
157
|
-
_See code: [src/commands/deploy.ts](https://github.com/chabokan/cli/blob/v0.8.
|
|
157
|
+
_See code: [src/commands/deploy.ts](https://github.com/chabokan/cli/blob/v0.8.15/src/commands/deploy.ts)_
|
|
158
158
|
|
|
159
159
|
## `chabok help [COMMAND]`
|
|
160
160
|
|
|
@@ -174,7 +174,7 @@ DESCRIPTION
|
|
|
174
174
|
Display help for chabok.
|
|
175
175
|
```
|
|
176
176
|
|
|
177
|
-
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.
|
|
177
|
+
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.29/src/commands/help.ts)_
|
|
178
178
|
|
|
179
179
|
## `chabok login`
|
|
180
180
|
|
|
@@ -194,7 +194,7 @@ DESCRIPTION
|
|
|
194
194
|
login to hub.chabokan.net account
|
|
195
195
|
```
|
|
196
196
|
|
|
197
|
-
_See code: [src/commands/login.ts](https://github.com/chabokan/cli/blob/v0.8.
|
|
197
|
+
_See code: [src/commands/login.ts](https://github.com/chabokan/cli/blob/v0.8.15/src/commands/login.ts)_
|
|
198
198
|
|
|
199
199
|
## `chabok plugins`
|
|
200
200
|
|
|
@@ -217,7 +217,7 @@ EXAMPLES
|
|
|
217
217
|
$ chabok plugins
|
|
218
218
|
```
|
|
219
219
|
|
|
220
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.
|
|
220
|
+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.43/src/commands/plugins/index.ts)_
|
|
221
221
|
|
|
222
222
|
## `chabok plugins add PLUGIN`
|
|
223
223
|
|
|
@@ -242,7 +242,7 @@ GLOBAL FLAGS
|
|
|
242
242
|
DESCRIPTION
|
|
243
243
|
Installs a plugin into chabok.
|
|
244
244
|
|
|
245
|
-
Uses
|
|
245
|
+
Uses npm to install plugins.
|
|
246
246
|
|
|
247
247
|
Installation of a user-installed plugin will override a core plugin.
|
|
248
248
|
|
|
@@ -291,7 +291,7 @@ EXAMPLES
|
|
|
291
291
|
$ chabok plugins inspect myplugin
|
|
292
292
|
```
|
|
293
293
|
|
|
294
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.
|
|
294
|
+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.43/src/commands/plugins/inspect.ts)_
|
|
295
295
|
|
|
296
296
|
## `chabok plugins install PLUGIN`
|
|
297
297
|
|
|
@@ -316,7 +316,7 @@ GLOBAL FLAGS
|
|
|
316
316
|
DESCRIPTION
|
|
317
317
|
Installs a plugin into chabok.
|
|
318
318
|
|
|
319
|
-
Uses
|
|
319
|
+
Uses npm to install plugins.
|
|
320
320
|
|
|
321
321
|
Installation of a user-installed plugin will override a core plugin.
|
|
322
322
|
|
|
@@ -340,7 +340,7 @@ EXAMPLES
|
|
|
340
340
|
$ chabok plugins install someuser/someplugin
|
|
341
341
|
```
|
|
342
342
|
|
|
343
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.
|
|
343
|
+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.43/src/commands/plugins/install.ts)_
|
|
344
344
|
|
|
345
345
|
## `chabok plugins link PATH`
|
|
346
346
|
|
|
@@ -360,6 +360,7 @@ FLAGS
|
|
|
360
360
|
|
|
361
361
|
DESCRIPTION
|
|
362
362
|
Links a plugin into the CLI for development.
|
|
363
|
+
|
|
363
364
|
Installation of a linked plugin will override a user-installed or core plugin.
|
|
364
365
|
|
|
365
366
|
e.g. If you have a user-installed or core plugin that has a 'hello' command, installing a linked plugin with a 'hello'
|
|
@@ -370,7 +371,7 @@ EXAMPLES
|
|
|
370
371
|
$ chabok plugins link myplugin
|
|
371
372
|
```
|
|
372
373
|
|
|
373
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.
|
|
374
|
+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.43/src/commands/plugins/link.ts)_
|
|
374
375
|
|
|
375
376
|
## `chabok plugins remove [PLUGIN]`
|
|
376
377
|
|
|
@@ -411,7 +412,7 @@ FLAGS
|
|
|
411
412
|
--reinstall Reinstall all plugins after uninstalling.
|
|
412
413
|
```
|
|
413
414
|
|
|
414
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.
|
|
415
|
+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.43/src/commands/plugins/reset.ts)_
|
|
415
416
|
|
|
416
417
|
## `chabok plugins uninstall [PLUGIN]`
|
|
417
418
|
|
|
@@ -439,7 +440,7 @@ EXAMPLES
|
|
|
439
440
|
$ chabok plugins uninstall myplugin
|
|
440
441
|
```
|
|
441
442
|
|
|
442
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.
|
|
443
|
+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.43/src/commands/plugins/uninstall.ts)_
|
|
443
444
|
|
|
444
445
|
## `chabok plugins unlink [PLUGIN]`
|
|
445
446
|
|
|
@@ -483,7 +484,7 @@ DESCRIPTION
|
|
|
483
484
|
Update installed plugins.
|
|
484
485
|
```
|
|
485
486
|
|
|
486
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.
|
|
487
|
+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.43/src/commands/plugins/update.ts)_
|
|
487
488
|
|
|
488
489
|
## `chabok service list`
|
|
489
490
|
|
|
@@ -500,7 +501,7 @@ DESCRIPTION
|
|
|
500
501
|
show account services list
|
|
501
502
|
```
|
|
502
503
|
|
|
503
|
-
_See code: [src/commands/service/list.ts](https://github.com/chabokan/cli/blob/v0.8.
|
|
504
|
+
_See code: [src/commands/service/list.ts](https://github.com/chabokan/cli/blob/v0.8.15/src/commands/service/list.ts)_
|
|
504
505
|
|
|
505
506
|
## `chabok service logs`
|
|
506
507
|
|
|
@@ -518,7 +519,7 @@ DESCRIPTION
|
|
|
518
519
|
read latest logs from service
|
|
519
520
|
```
|
|
520
521
|
|
|
521
|
-
_See code: [src/commands/service/logs.ts](https://github.com/chabokan/cli/blob/v0.8.
|
|
522
|
+
_See code: [src/commands/service/logs.ts](https://github.com/chabokan/cli/blob/v0.8.15/src/commands/service/logs.ts)_
|
|
522
523
|
|
|
523
524
|
## `chabok service resize`
|
|
524
525
|
|
|
@@ -539,7 +540,7 @@ DESCRIPTION
|
|
|
539
540
|
resize a service
|
|
540
541
|
```
|
|
541
542
|
|
|
542
|
-
_See code: [src/commands/service/resize.ts](https://github.com/chabokan/cli/blob/v0.8.
|
|
543
|
+
_See code: [src/commands/service/resize.ts](https://github.com/chabokan/cli/blob/v0.8.15/src/commands/service/resize.ts)_
|
|
543
544
|
|
|
544
545
|
## `chabok service restart`
|
|
545
546
|
|
|
@@ -557,7 +558,7 @@ DESCRIPTION
|
|
|
557
558
|
restart a service
|
|
558
559
|
```
|
|
559
560
|
|
|
560
|
-
_See code: [src/commands/service/restart.ts](https://github.com/chabokan/cli/blob/v0.8.
|
|
561
|
+
_See code: [src/commands/service/restart.ts](https://github.com/chabokan/cli/blob/v0.8.15/src/commands/service/restart.ts)_
|
|
561
562
|
|
|
562
563
|
## `chabok service start`
|
|
563
564
|
|
|
@@ -575,7 +576,7 @@ DESCRIPTION
|
|
|
575
576
|
start a service
|
|
576
577
|
```
|
|
577
578
|
|
|
578
|
-
_See code: [src/commands/service/start.ts](https://github.com/chabokan/cli/blob/v0.8.
|
|
579
|
+
_See code: [src/commands/service/start.ts](https://github.com/chabokan/cli/blob/v0.8.15/src/commands/service/start.ts)_
|
|
579
580
|
|
|
580
581
|
## `chabok service stop`
|
|
581
582
|
|
|
@@ -593,7 +594,7 @@ DESCRIPTION
|
|
|
593
594
|
stop a service
|
|
594
595
|
```
|
|
595
596
|
|
|
596
|
-
_See code: [src/commands/service/stop.ts](https://github.com/chabokan/cli/blob/v0.8.
|
|
597
|
+
_See code: [src/commands/service/stop.ts](https://github.com/chabokan/cli/blob/v0.8.15/src/commands/service/stop.ts)_
|
|
597
598
|
|
|
598
599
|
## `chabok version`
|
|
599
600
|
|
|
@@ -613,5 +614,5 @@ FLAG DESCRIPTIONS
|
|
|
613
614
|
Additionally shows the architecture, node version, operating system, and versions of plugins that the CLI is using.
|
|
614
615
|
```
|
|
615
616
|
|
|
616
|
-
_See code: [@oclif/plugin-version](https://github.com/oclif/plugin-version/blob/v2.
|
|
617
|
+
_See code: [@oclif/plugin-version](https://github.com/oclif/plugin-version/blob/v2.2.30/src/commands/version.ts)_
|
|
617
618
|
<!-- commandsstop -->
|
package/dist/base.d.ts
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { Command } from '@oclif/core';
|
|
2
|
+
import { AxiosRequestConfig } from 'axios';
|
|
3
|
+
import type { ConfigFile } from './types.js';
|
|
2
4
|
export default abstract class extends Command {
|
|
3
5
|
static flags: {
|
|
4
6
|
help: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<void>;
|
|
5
7
|
};
|
|
6
|
-
axiosConfig:
|
|
7
|
-
got: import("got").Got
|
|
8
|
-
read_config(): Promise<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
axiosConfig: AxiosRequestConfig;
|
|
9
|
+
got: import("got").Got<never>;
|
|
10
|
+
read_config(): Promise<ConfigFile>;
|
|
11
|
+
write_config(object: ConfigFile): Promise<void>;
|
|
12
|
+
get_services(filter?: Record<string, string>): Promise<Array<{
|
|
13
|
+
value: string;
|
|
14
|
+
name: string;
|
|
15
|
+
}>>;
|
|
14
16
|
init_run(): Promise<void>;
|
|
15
17
|
}
|
package/dist/base.js
CHANGED
|
@@ -11,14 +11,15 @@ export default class default_1 extends Command {
|
|
|
11
11
|
help: Flags.help({ char: 'h' }),
|
|
12
12
|
};
|
|
13
13
|
axiosConfig = {
|
|
14
|
-
...axios.defaults
|
|
14
|
+
...axios.defaults,
|
|
15
|
+
headers: {}
|
|
15
16
|
};
|
|
16
17
|
got = got.extend();
|
|
17
18
|
async read_config() {
|
|
18
19
|
return read_config_file();
|
|
19
20
|
}
|
|
20
21
|
async write_config(object) {
|
|
21
|
-
fs.writeFileSync(GLOBAL_CONF_PATH, JSON.stringify(object));
|
|
22
|
+
fs.writeFileSync(GLOBAL_CONF_PATH, JSON.stringify(object, null, 2));
|
|
22
23
|
}
|
|
23
24
|
async get_services(filter = {}) {
|
|
24
25
|
return await get_all_services(filter, this.axiosConfig);
|
|
@@ -28,20 +29,19 @@ export default class default_1 extends Command {
|
|
|
28
29
|
const main_agent = new https.Agent({
|
|
29
30
|
rejectUnauthorized: false
|
|
30
31
|
});
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
const gotConfig = {
|
|
33
|
+
prefixUrl: BASE_API_URL,
|
|
34
|
+
agent: { https: main_agent }
|
|
35
|
+
};
|
|
33
36
|
this.axiosConfig.httpsAgent = main_agent;
|
|
34
37
|
this.axiosConfig.baseURL = BASE_API_URL;
|
|
35
|
-
gotConfig.prefixUrl = this.axiosConfig.baseURL;
|
|
36
|
-
gotConfig.agent = { https: main_agent };
|
|
37
38
|
const proxy = process.env.http_proxy || process.env.https_proxy;
|
|
38
39
|
if (proxy) {
|
|
39
40
|
this.log(`Using proxy server ${proxy}`);
|
|
40
|
-
// @
|
|
41
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
41
42
|
const agent = new HttpsProxyAgent(proxy);
|
|
42
43
|
this.axiosConfig.httpsAgent = agent;
|
|
43
44
|
this.axiosConfig.proxy = false;
|
|
44
|
-
// @ts-ignore
|
|
45
45
|
gotConfig.agent = { https: agent };
|
|
46
46
|
}
|
|
47
47
|
const config_json = read_config_file();
|
|
@@ -49,9 +49,12 @@ export default class default_1 extends Command {
|
|
|
49
49
|
if (isEmptyObject(config_json) || isEmptyObject(config_json.users)) {
|
|
50
50
|
return;
|
|
51
51
|
}
|
|
52
|
-
|
|
53
|
-
const token = config_json.users[
|
|
52
|
+
const defaultUser = config_json.default_user;
|
|
53
|
+
const token = defaultUser && config_json.users[defaultUser]?.token;
|
|
54
54
|
if (token) {
|
|
55
|
+
if (!this.axiosConfig.headers) {
|
|
56
|
+
this.axiosConfig.headers = {};
|
|
57
|
+
}
|
|
55
58
|
this.axiosConfig.headers.Authorization = `Token ${token}`;
|
|
56
59
|
gotConfig.headers = { Authorization: `Token ${token}` };
|
|
57
60
|
}
|
|
@@ -1,28 +1,37 @@
|
|
|
1
1
|
import Command from "../../base.js";
|
|
2
2
|
import { ux } from "@oclif/core";
|
|
3
|
+
import chalk from "chalk";
|
|
3
4
|
export default class AccountList extends Command {
|
|
4
5
|
static description = "show accounts list";
|
|
5
6
|
static flags = {
|
|
6
7
|
...Command.flags,
|
|
7
8
|
};
|
|
8
9
|
async run() {
|
|
9
|
-
const {
|
|
10
|
+
const { flags } = await this.parse(AccountList);
|
|
10
11
|
const cli = this;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
try {
|
|
13
|
+
await this.init_run();
|
|
14
|
+
const config_json = await this.read_config();
|
|
15
|
+
if (Object.keys(config_json.users).length > 0) {
|
|
16
|
+
const accounts_data = Object.keys(config_json.users).map((account) => {
|
|
17
|
+
return {
|
|
18
|
+
Name: account,
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
ux.table(accounts_data, {
|
|
22
|
+
Name: {},
|
|
23
|
+
}, flags);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
cli.log(`${chalk.yellow('[Info]')} No accounts found. Please login first using 'chabok login'.`);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
22
29
|
}
|
|
23
|
-
|
|
24
|
-
cli.log(
|
|
25
|
-
|
|
30
|
+
catch (error) {
|
|
31
|
+
cli.log(`${chalk.red('[Error]')} Failed to list accounts. Please try again.`);
|
|
32
|
+
if (process.env.CHABOK_DEBUG === "true") {
|
|
33
|
+
cli.log(error);
|
|
34
|
+
}
|
|
26
35
|
}
|
|
27
36
|
}
|
|
28
37
|
}
|
|
@@ -11,24 +11,28 @@ export default class AccountRemove extends Command {
|
|
|
11
11
|
};
|
|
12
12
|
async run() {
|
|
13
13
|
const cli = this;
|
|
14
|
-
const {
|
|
14
|
+
const { flags } = await this.parse(AccountRemove);
|
|
15
15
|
const config_json = read_config_file();
|
|
16
16
|
if (isEmptyObject(config_json.users)) {
|
|
17
17
|
cli.log(`${chalk.red("[Error]")} first you should login!`);
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
const { user } = await inquirer.prompt({
|
|
21
21
|
type: "list",
|
|
22
22
|
message: "Please select a user:",
|
|
23
23
|
name: "user",
|
|
24
24
|
choices: Object.keys(config_json.users),
|
|
25
25
|
});
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
if (user in config_json.users) {
|
|
27
|
+
delete config_json.users[user];
|
|
28
|
+
if (config_json.default_user === user) {
|
|
29
|
+
config_json.default_user = "";
|
|
30
|
+
}
|
|
31
|
+
fs.writeFileSync(GLOBAL_CONF_PATH, JSON.stringify(config_json, null, 2));
|
|
32
|
+
cli.log(`${chalk.green("[Success]")} user deleted successfully.`);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
cli.log(`${chalk.red("[Error]")} selected user does not exist!`);
|
|
30
36
|
}
|
|
31
|
-
fs.writeFileSync(GLOBAL_CONF_PATH, JSON.stringify(config_json));
|
|
32
|
-
cli.log(`${chalk.green("[Success]")} user deleted successfully.`);
|
|
33
37
|
}
|
|
34
38
|
}
|
|
@@ -13,7 +13,7 @@ export default class AccountUse extends Command {
|
|
|
13
13
|
};
|
|
14
14
|
async run() {
|
|
15
15
|
const cli = this;
|
|
16
|
-
const {
|
|
16
|
+
const { flags } = await this.parse(AccountUse);
|
|
17
17
|
const config_json = read_config_file();
|
|
18
18
|
let default_user = flags.user;
|
|
19
19
|
if (isEmptyObject(config_json.users)) {
|
|
@@ -21,7 +21,7 @@ export default class AccountUse extends Command {
|
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
23
|
if (!flags.user) {
|
|
24
|
-
|
|
24
|
+
const { user } = await inquirer.prompt({
|
|
25
25
|
type: "list",
|
|
26
26
|
message: "Please select a user:",
|
|
27
27
|
name: "user",
|
|
@@ -29,13 +29,13 @@ export default class AccountUse extends Command {
|
|
|
29
29
|
});
|
|
30
30
|
default_user = user;
|
|
31
31
|
}
|
|
32
|
-
if (default_user in config_json.users) {
|
|
33
|
-
config_json
|
|
34
|
-
fs.writeFileSync(GLOBAL_CONF_PATH, JSON.stringify(config_json));
|
|
32
|
+
if (default_user && default_user in config_json.users) {
|
|
33
|
+
config_json.default_user = default_user;
|
|
34
|
+
fs.writeFileSync(GLOBAL_CONF_PATH, JSON.stringify(config_json, null, 2));
|
|
35
35
|
cli.log(`${chalk.green("[Success]")} user changed successfully.`);
|
|
36
36
|
}
|
|
37
37
|
else {
|
|
38
|
-
cli.log(`${chalk.red("[Error]")} selected user not exist!`);
|
|
38
|
+
cli.log(`${chalk.red("[Error]")} selected user does not exist!`);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import Command from "../base.js";
|
|
2
|
+
import type { ChabokFile } from "../types.js";
|
|
2
3
|
export default class Deploy extends Command {
|
|
3
4
|
static description: string;
|
|
4
5
|
static flags: {
|
|
@@ -7,8 +8,8 @@ export default class Deploy extends Command {
|
|
|
7
8
|
help: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<void>;
|
|
8
9
|
};
|
|
9
10
|
run(): Promise<void>;
|
|
10
|
-
prepare_archive(project_path:
|
|
11
|
-
upload(archive_path:
|
|
11
|
+
prepare_archive(project_path: string): Promise<string>;
|
|
12
|
+
upload(archive_path: string, selected_service: string, cli: Command, chabok_file: ChabokFile): Promise<{
|
|
12
13
|
success: boolean;
|
|
13
14
|
message: string;
|
|
14
15
|
}>;
|