Skip to content

Commit 975f75b

Browse files
committed
feat: fix load fatal: no private-key
1 parent 38198e4 commit 975f75b

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

src/command/baseSubCommand.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@ class BaseSubCommand {
197197
...rc,
198198
...uniOptions
199199
});
200-
201200
const globalPrompts = globalOptionsPrompts.filter(
202201
prompt => this.validatorDesc[prompt.name]?.required && !options[prompt.name]
203202
);
@@ -223,11 +222,15 @@ class BaseSubCommand {
223222
}
224223
const subOptionsLength = Object.keys(subCommandOptions).length;
225224
if (subOptionsLength < this.parameters.length) {
226-
const response = BaseSubCommand.normalizeConfig(await inquirer.prompt(this.parameters.slice(subOptionsLength)));
227-
subCommandOptions = {
228-
...subCommandOptions,
229-
...response
230-
};
225+
try {
226+
const response = BaseSubCommand.normalizeConfig(await inquirer.prompt(this.parameters.slice(subOptionsLength)));
227+
subCommandOptions = {
228+
...subCommandOptions,
229+
...response
230+
};
231+
} catch (e) {
232+
console.error(e);
233+
}
231234
}
232235
return {
233236
localOptions,

src/utils/constants.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ const loadCommandParameters = [
261261
inactive: 'no',
262262
suffix: '?',
263263
when(answers) {
264-
return answers['private-key'].trim().split(' ').length > 1;
264+
return answers['private-key']?.trim().split(' ').length > 1;
265265
}
266266
},
267267
{

0 commit comments

Comments
 (0)