Skip to content

Commit f708a69

Browse files
chore: cleanup
1 parent ad49d55 commit f708a69

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/SfCommandError.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,25 +110,20 @@ export class SfCommandError extends SfError {
110110
--second "my second"
111111
*/
112112

113-
// find the flag before the 'args' block that's valid, to append the args with its value as a suggestion
114-
// const target = output.find((flag, index) => flag.type === 'flag' && output[index + 1]?.type === 'arg');
115-
116-
const catcher: Array<{ flag: string; args: string[] }> = [];
113+
const aggregator: Array<{ flag: string; args: string[] }> = [];
117114
output.forEach((k, i) => {
118115
let argCounter = i + 1;
119116
if (k.type === 'flag' && output[argCounter].type === 'arg') {
120117
const args: string[] = [];
121-
// add the flag name, and first correctly parsed value to the suggestion
122-
123118
while (output[argCounter]?.type === 'arg') {
124119
args.push(output[argCounter].input);
125120
argCounter++;
126121
}
127-
catcher.push({ flag: k.flag, args: [k.input, ...args] });
122+
aggregator.push({ flag: k.flag, args: [k.input, ...args] });
128123
}
129124
});
130125

131126
this.actions ??= [];
132-
this.actions.push(...catcher.map((cause) => `--${cause.flag} "${cause.args.join(' ')}"`));
127+
this.actions.push(...aggregator.map((cause) => `--${cause.flag} "${cause.args.join(' ')}"`));
133128
}
134129
}

0 commit comments

Comments
 (0)