@pikecode/api-key-manager 1.3.91 → 2.0.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/README.md +79 -52
- package/bin/akm.js +47 -30
- package/package.json +13 -8
- package/src/CommandRegistry.js +2 -2
- package/src/commands/add/prompts.js +200 -171
- package/src/commands/add/providerSaver.js +6 -7
- package/src/commands/add.js +6 -2
- package/src/commands/backup.js +99 -45
- package/src/commands/current.js +41 -20
- package/src/commands/edit.js +3 -289
- package/src/commands/health.js +75 -31
- package/src/commands/list.js +39 -19
- package/src/commands/remove.js +2 -2
- package/src/commands/switch/provider-edit-questions-helper.js +29 -7
- package/src/commands/switch/provider-manager.js +39 -40
- package/src/commands/switch.js +9 -8
- package/src/config.js +68 -45
- package/src/index.js +1 -1
- package/src/utils/atomic-file.js +47 -0
- package/src/utils/claude-settings.js +4 -3
- package/src/utils/codex-files.js +227 -38
- package/src/utils/codex-launcher.js +16 -8
- package/src/utils/concurrency.js +30 -0
- package/src/utils/env-launcher.js +17 -1
- package/src/utils/import-validator.js +210 -0
- package/src/utils/launch-args.js +60 -1
- package/src/utils/provider-status-checker.js +49 -24
- package/src/utils/shell-snippets.js +32 -0
- package/src/utils/terminal-format.js +22 -4
- package/src/utils/ui-helper.js +0 -1
- package/src/utils/update-checker.js +3 -3
- package/src/utils/validator.js +81 -10
|
@@ -5,8 +5,6 @@
|
|
|
5
5
|
* into focused pieces to keep each function under 50 lines.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
const inquirer = require('inquirer');
|
|
9
|
-
const chalk = require('chalk');
|
|
10
8
|
const { validator } = require('../../utils/validator');
|
|
11
9
|
const { UIHelper } = require('../../utils/ui-helper');
|
|
12
10
|
const { UI_MESSAGES } = require('../../constants/ui');
|
|
@@ -20,117 +18,125 @@ const { getCodexLaunchArgs } = require('../../utils/launch-args');
|
|
|
20
18
|
* @returns {Promise<Object>} answers object
|
|
21
19
|
*/
|
|
22
20
|
async function promptProviderInfo(adder) {
|
|
23
|
-
return await adder.promptWithESC(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
{
|
|
36
|
-
type: 'input',
|
|
37
|
-
name: 'name',
|
|
38
|
-
message: UI_MESSAGES.INPUT_PROVIDER_NAME,
|
|
39
|
-
validate: (input) => {
|
|
40
|
-
const err = validator.validateName(input);
|
|
41
|
-
return err || true;
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
type: 'list',
|
|
46
|
-
name: 'authMode',
|
|
47
|
-
message: UI_MESSAGES.SELECT_AUTH_MODE,
|
|
48
|
-
choices: [
|
|
49
|
-
{ name: UI_MESSAGES.AUTH_MODE_API_KEY, value: 'api_key' },
|
|
50
|
-
{ name: UI_MESSAGES.AUTH_MODE_AUTH_TOKEN, value: 'auth_token' }
|
|
51
|
-
],
|
|
52
|
-
default: 'api_key',
|
|
53
|
-
when: (answers) => (answers.ideName || adder.presetIdeName) !== 'codex'
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
type: 'input',
|
|
57
|
-
name: 'baseUrl',
|
|
58
|
-
message: UI_MESSAGES.INPUT_BASE_URL,
|
|
59
|
-
validate: (input) => {
|
|
60
|
-
if (!input) return 'API 基础URL不能为空';
|
|
61
|
-
const err = validator.validateUrl(input);
|
|
62
|
-
return err || true;
|
|
21
|
+
return await adder.promptWithESC(
|
|
22
|
+
[
|
|
23
|
+
{
|
|
24
|
+
type: 'list',
|
|
25
|
+
name: 'ideName',
|
|
26
|
+
message: UI_MESSAGES.SELECT_IDE,
|
|
27
|
+
choices: [
|
|
28
|
+
{ name: UI_MESSAGES.IDE_CLAUDE_CODE, value: 'claude' },
|
|
29
|
+
{ name: UI_MESSAGES.IDE_CODEX, value: 'codex' }
|
|
30
|
+
],
|
|
31
|
+
default: adder.presetIdeName || 'claude',
|
|
32
|
+
when: () => !adder.presetIdeName
|
|
63
33
|
},
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
34
|
+
{
|
|
35
|
+
type: 'input',
|
|
36
|
+
name: 'name',
|
|
37
|
+
message: UI_MESSAGES.INPUT_PROVIDER_NAME,
|
|
38
|
+
validate: input => {
|
|
39
|
+
const err = validator.validateName(input);
|
|
40
|
+
return err || true;
|
|
41
|
+
}
|
|
72
42
|
},
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
43
|
+
{
|
|
44
|
+
type: 'list',
|
|
45
|
+
name: 'authMode',
|
|
46
|
+
message: UI_MESSAGES.SELECT_AUTH_MODE,
|
|
47
|
+
choices: [
|
|
48
|
+
{ name: UI_MESSAGES.AUTH_MODE_API_KEY, value: 'api_key' },
|
|
49
|
+
{ name: UI_MESSAGES.AUTH_MODE_AUTH_TOKEN, value: 'auth_token' }
|
|
50
|
+
],
|
|
51
|
+
default: 'api_key',
|
|
52
|
+
when: answers => (answers.ideName || adder.presetIdeName) !== 'codex'
|
|
76
53
|
},
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
const err = validator.validateUrl(input);
|
|
88
|
-
return err || true;
|
|
54
|
+
{
|
|
55
|
+
type: 'input',
|
|
56
|
+
name: 'baseUrl',
|
|
57
|
+
message: UI_MESSAGES.INPUT_BASE_URL,
|
|
58
|
+
validate: input => {
|
|
59
|
+
if (!input) return 'API 基础URL不能为空';
|
|
60
|
+
const err = validator.validateUrl(input);
|
|
61
|
+
return err || true;
|
|
62
|
+
},
|
|
63
|
+
when: answers => (answers.ideName || adder.presetIdeName) !== 'codex'
|
|
89
64
|
},
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
65
|
+
{
|
|
66
|
+
type: 'input',
|
|
67
|
+
name: 'authToken',
|
|
68
|
+
message: answers => {
|
|
69
|
+
const envVar =
|
|
70
|
+
answers.authMode === 'auth_token' ? 'ANTHROPIC_AUTH_TOKEN' : 'ANTHROPIC_API_KEY';
|
|
71
|
+
return `${UI_MESSAGES.INPUT_TOKEN} (${envVar}):`;
|
|
72
|
+
},
|
|
73
|
+
validate: input => {
|
|
74
|
+
const err = validator.validateToken(input);
|
|
75
|
+
return err || true;
|
|
76
|
+
},
|
|
77
|
+
when: answers => (answers.ideName || adder.presetIdeName) !== 'codex'
|
|
100
78
|
},
|
|
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
|
-
|
|
79
|
+
// Codex‑specific prompts (manual entry)
|
|
80
|
+
{
|
|
81
|
+
type: 'input',
|
|
82
|
+
name: 'baseUrl',
|
|
83
|
+
message: UI_MESSAGES.INPUT_OPENAI_BASE_URL,
|
|
84
|
+
default: '',
|
|
85
|
+
validate: input => {
|
|
86
|
+
if (!input) return true;
|
|
87
|
+
const err = validator.validateUrl(input);
|
|
88
|
+
return err || true;
|
|
89
|
+
},
|
|
90
|
+
when: answers => (answers.ideName || adder.presetIdeName) === 'codex'
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
type: 'input',
|
|
94
|
+
name: 'authToken',
|
|
95
|
+
message: UI_MESSAGES.INPUT_OPENAI_API_KEY,
|
|
96
|
+
validate: input => {
|
|
97
|
+
if (!input) return 'API Key 不能为空';
|
|
98
|
+
const err = validator.validateToken(input);
|
|
99
|
+
return err || true;
|
|
100
|
+
},
|
|
101
|
+
when: answers => (answers.ideName || adder.presetIdeName) === 'codex'
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
type: 'confirm',
|
|
105
|
+
name: 'setAsDefault',
|
|
106
|
+
message: UI_MESSAGES.SET_AS_DEFAULT,
|
|
107
|
+
default: true
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
type: 'confirm',
|
|
111
|
+
name: 'configureLaunchArgs',
|
|
112
|
+
message: UI_MESSAGES.CONFIGURE_LAUNCH_ARGS,
|
|
113
|
+
default: false,
|
|
114
|
+
when: answers => (answers.ideName || adder.presetIdeName) !== 'codex'
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
type: 'confirm',
|
|
118
|
+
name: 'configureCodexLaunchArgs',
|
|
119
|
+
message: UI_MESSAGES.CONFIGURE_CODEX_LAUNCH_ARGS,
|
|
120
|
+
default: false,
|
|
121
|
+
when: answers => (answers.ideName || adder.presetIdeName) === 'codex'
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
type: 'confirm',
|
|
125
|
+
name: 'configureModels',
|
|
126
|
+
message: UI_MESSAGES.CONFIGURE_MODELS,
|
|
127
|
+
default: false,
|
|
128
|
+
when: answers => (answers.ideName || adder.presetIdeName) !== 'codex'
|
|
129
|
+
}
|
|
130
|
+
],
|
|
131
|
+
UI_MESSAGES.ESC_CANCEL_ADD,
|
|
132
|
+
async () => {
|
|
133
|
+
Logger.info(UI_MESSAGES.ADD_PROVIDER_CANCELLED);
|
|
134
|
+
if (adder.returnToParent) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
await registry.executeCommand('switch');
|
|
129
138
|
}
|
|
130
|
-
|
|
131
|
-
Logger.info(UI_MESSAGES.ADD_PROVIDER_CANCELLED);
|
|
132
|
-
registry.executeCommand('switch');
|
|
133
|
-
});
|
|
139
|
+
);
|
|
134
140
|
}
|
|
135
141
|
|
|
136
142
|
/**
|
|
@@ -142,29 +148,36 @@ async function promptLaunchArgs(adder) {
|
|
|
142
148
|
console.log(UIHelper.createTooltip(UI_MESSAGES.CONFIG_LAUNCH_ARGS_TOOLTIP));
|
|
143
149
|
console.log();
|
|
144
150
|
console.log(UIHelper.createStepIndicator(2, 2, UI_MESSAGES.ADD_PROVIDER_STEP_2_LAUNCH_ARGS));
|
|
145
|
-
console.log(
|
|
146
|
-
[
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
151
|
+
console.log(
|
|
152
|
+
UIHelper.createHintLine([
|
|
153
|
+
[UI_MESSAGES.HINT_SPACE, UI_MESSAGES.HINT_SPACE_DESC],
|
|
154
|
+
[UI_MESSAGES.HINT_A, UI_MESSAGES.HINT_A_DESC],
|
|
155
|
+
[UI_MESSAGES.HINT_I, UI_MESSAGES.HINT_I_DESC],
|
|
156
|
+
[UI_MESSAGES.HINT_ENTER, UI_MESSAGES.HINT_ENTER_CONFIRM],
|
|
157
|
+
[UI_MESSAGES.HINT_ESC, UI_MESSAGES.HINT_ESC_SKIP]
|
|
158
|
+
])
|
|
159
|
+
);
|
|
152
160
|
console.log();
|
|
153
161
|
|
|
154
|
-
const result = await adder.promptWithESCAndDefault(
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
162
|
+
const result = await adder.promptWithESCAndDefault(
|
|
163
|
+
[
|
|
164
|
+
{
|
|
165
|
+
type: 'checkbox',
|
|
166
|
+
name: 'launchArgs',
|
|
167
|
+
message: UI_MESSAGES.SELECT_LAUNCH_ARGS,
|
|
168
|
+
choices: validator.getAvailableLaunchArgs().map(arg => ({
|
|
169
|
+
name: `${arg.name} - ${arg.description}`,
|
|
170
|
+
value: arg.name,
|
|
171
|
+
checked: false
|
|
172
|
+
}))
|
|
173
|
+
}
|
|
174
|
+
],
|
|
175
|
+
UI_MESSAGES.ESC_SKIP_CONFIG,
|
|
176
|
+
() => {
|
|
177
|
+
Logger.info(UI_MESSAGES.CONFIG_LAUNCH_ARGS_SKIP);
|
|
178
|
+
},
|
|
179
|
+
{ launchArgs: [] }
|
|
180
|
+
);
|
|
168
181
|
|
|
169
182
|
return result.launchArgs;
|
|
170
183
|
}
|
|
@@ -178,30 +191,37 @@ async function promptModelConfig(adder) {
|
|
|
178
191
|
console.log(UIHelper.createTooltip(UI_MESSAGES.CONFIG_MODELS_TOOLTIP));
|
|
179
192
|
console.log();
|
|
180
193
|
console.log(UIHelper.createStepIndicator(2, 2, UI_MESSAGES.ADD_PROVIDER_STEP_2_MODELS));
|
|
181
|
-
console.log(
|
|
182
|
-
[
|
|
183
|
-
|
|
184
|
-
|
|
194
|
+
console.log(
|
|
195
|
+
UIHelper.createHintLine([
|
|
196
|
+
[UI_MESSAGES.HINT_ENTER, UI_MESSAGES.HINT_ENTER_DESC],
|
|
197
|
+
[UI_MESSAGES.HINT_ESC, UI_MESSAGES.HINT_ESC_SKIP]
|
|
198
|
+
])
|
|
199
|
+
);
|
|
185
200
|
console.log();
|
|
186
201
|
|
|
187
|
-
const responses = await adder.promptWithESCAndDefault(
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
202
|
+
const responses = await adder.promptWithESCAndDefault(
|
|
203
|
+
[
|
|
204
|
+
{
|
|
205
|
+
type: 'input',
|
|
206
|
+
name: 'primaryModel',
|
|
207
|
+
message: UI_MESSAGES.INPUT_PRIMARY_MODEL,
|
|
208
|
+
default: '',
|
|
209
|
+
validate: input => validator.validateModel(input) || true
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
type: 'input',
|
|
213
|
+
name: 'smallFastModel',
|
|
214
|
+
message: UI_MESSAGES.INPUT_SMALL_FAST_MODEL,
|
|
215
|
+
default: '',
|
|
216
|
+
validate: input => validator.validateModel(input) || true
|
|
217
|
+
}
|
|
218
|
+
],
|
|
219
|
+
UI_MESSAGES.ESC_SKIP_CONFIG,
|
|
220
|
+
() => {
|
|
221
|
+
Logger.info(UI_MESSAGES.CONFIG_MODELS_SKIP);
|
|
194
222
|
},
|
|
195
|
-
{
|
|
196
|
-
|
|
197
|
-
name: 'smallFastModel',
|
|
198
|
-
message: UI_MESSAGES.INPUT_SMALL_FAST_MODEL,
|
|
199
|
-
default: '',
|
|
200
|
-
validate: (input) => validator.validateModel(input) || true
|
|
201
|
-
}
|
|
202
|
-
], UI_MESSAGES.ESC_SKIP_CONFIG, () => {
|
|
203
|
-
Logger.info(UI_MESSAGES.CONFIG_MODELS_SKIP);
|
|
204
|
-
}, { primaryModel: null, smallFastModel: null });
|
|
223
|
+
{ primaryModel: null, smallFastModel: null }
|
|
224
|
+
);
|
|
205
225
|
|
|
206
226
|
return { primaryModel: responses.primaryModel, smallFastModel: responses.smallFastModel };
|
|
207
227
|
}
|
|
@@ -211,34 +231,43 @@ async function promptModelConfig(adder) {
|
|
|
211
231
|
*/
|
|
212
232
|
async function promptCodexLaunchArgs(adder) {
|
|
213
233
|
// Reuse the same UI as the generic launch args but fetch Codex args.
|
|
214
|
-
console.log(
|
|
234
|
+
console.log(
|
|
235
|
+
UIHelper.createTitle(UI_MESSAGES.CONFIG_CODEX_LAUNCH_ARGS_TITLE, UIHelper.icons.settings)
|
|
236
|
+
);
|
|
215
237
|
console.log();
|
|
216
238
|
console.log(UIHelper.createTooltip(UI_MESSAGES.CONFIG_CODEX_LAUNCH_ARGS_TOOLTIP));
|
|
217
239
|
console.log();
|
|
218
240
|
console.log(UIHelper.createStepIndicator(2, 2, UI_MESSAGES.ADD_PROVIDER_STEP_2_LAUNCH_ARGS));
|
|
219
|
-
console.log(
|
|
220
|
-
[
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
241
|
+
console.log(
|
|
242
|
+
UIHelper.createHintLine([
|
|
243
|
+
[UI_MESSAGES.HINT_SPACE, UI_MESSAGES.HINT_SPACE_DESC],
|
|
244
|
+
[UI_MESSAGES.HINT_A, UI_MESSAGES.HINT_A_DESC],
|
|
245
|
+
[UI_MESSAGES.HINT_I, UI_MESSAGES.HINT_I_DESC],
|
|
246
|
+
[UI_MESSAGES.HINT_ENTER, UI_MESSAGES.HINT_ENTER_CONFIRM],
|
|
247
|
+
[UI_MESSAGES.HINT_ESC, UI_MESSAGES.HINT_ESC_SKIP]
|
|
248
|
+
])
|
|
249
|
+
);
|
|
226
250
|
console.log();
|
|
227
251
|
|
|
228
|
-
const result = await adder.promptWithESCAndDefault(
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
252
|
+
const result = await adder.promptWithESCAndDefault(
|
|
253
|
+
[
|
|
254
|
+
{
|
|
255
|
+
type: 'checkbox',
|
|
256
|
+
name: 'launchArgs',
|
|
257
|
+
message: UI_MESSAGES.SELECT_LAUNCH_ARGS,
|
|
258
|
+
choices: getCodexLaunchArgs().map(arg => ({
|
|
259
|
+
name: `${arg.name} - ${arg.description}`,
|
|
260
|
+
value: arg.name,
|
|
261
|
+
checked: false
|
|
262
|
+
}))
|
|
263
|
+
}
|
|
264
|
+
],
|
|
265
|
+
UI_MESSAGES.ESC_SKIP_CONFIG,
|
|
266
|
+
() => {
|
|
267
|
+
Logger.info(UI_MESSAGES.CONFIG_CODEX_LAUNCH_ARGS_SKIP);
|
|
268
|
+
},
|
|
269
|
+
{ launchArgs: [] }
|
|
270
|
+
);
|
|
242
271
|
|
|
243
272
|
return result.launchArgs;
|
|
244
273
|
}
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
const { Logger } = require('../../utils/logger');
|
|
8
|
-
const { UIHelper } = require('../../utils/ui-helper');
|
|
9
8
|
const { promptCodexLaunchArgs, promptLaunchArgs, promptModelConfig } = require('./prompts');
|
|
10
9
|
const { printProviderSummary } = require('./summaryPrinter');
|
|
11
10
|
const { registry } = require('../../CommandRegistry');
|
|
@@ -31,13 +30,9 @@ async function saveProvider(adder, answers) {
|
|
|
31
30
|
// 处理启动参数
|
|
32
31
|
let launchArgs = [];
|
|
33
32
|
if (answers.ideName === 'codex') {
|
|
34
|
-
launchArgs = answers.configureCodexLaunchArgs
|
|
35
|
-
? await promptCodexLaunchArgs(adder)
|
|
36
|
-
: [];
|
|
33
|
+
launchArgs = answers.configureCodexLaunchArgs ? await promptCodexLaunchArgs(adder) : [];
|
|
37
34
|
} else {
|
|
38
|
-
launchArgs = answers.configureLaunchArgs
|
|
39
|
-
? await promptLaunchArgs(adder)
|
|
40
|
-
: [];
|
|
35
|
+
launchArgs = answers.configureLaunchArgs ? await promptLaunchArgs(adder) : [];
|
|
41
36
|
}
|
|
42
37
|
|
|
43
38
|
// 处理模型配置(仅非 Codex)
|
|
@@ -64,6 +59,10 @@ async function saveProvider(adder, answers) {
|
|
|
64
59
|
await printProviderSummary(adder, answers, launchArgs, modelConfig);
|
|
65
60
|
await adder.pauseBeforeReturn();
|
|
66
61
|
|
|
62
|
+
if (adder.returnToParent) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
67
66
|
return await registry.executeCommand('switch');
|
|
68
67
|
} catch (error) {
|
|
69
68
|
if (adder.isEscCancelled(error)) return;
|
package/src/commands/add.js
CHANGED
|
@@ -26,6 +26,7 @@ class ProviderAdder extends BaseCommand {
|
|
|
26
26
|
super();
|
|
27
27
|
this.configManager = configManager;
|
|
28
28
|
this.presetIdeName = options.ideName || null;
|
|
29
|
+
this.returnToParent = options.returnToParent === true;
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
/**
|
|
@@ -92,10 +93,13 @@ class ProviderAdder extends BaseCommand {
|
|
|
92
93
|
message: `供应商 '${name}' 已存在,是否覆盖?`,
|
|
93
94
|
default: false
|
|
94
95
|
}
|
|
95
|
-
], '取消覆盖', () => {
|
|
96
|
+
], '取消覆盖', async () => {
|
|
96
97
|
Logger.info('取消覆盖供应商');
|
|
98
|
+
if (this.returnToParent) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
97
101
|
const { registry } = require('../CommandRegistry');
|
|
98
|
-
registry.executeCommand('switch');
|
|
102
|
+
await registry.executeCommand('switch');
|
|
99
103
|
});
|
|
100
104
|
|
|
101
105
|
return overwrite;
|