Skip to content

Commit 52baba9

Browse files
committed
fix(cli): Remove redundant style variable and filter empty strings in coerceNumberArray
1 parent 8206d7b commit 52baba9

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/cli/__tests__/schema-to-yargs.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ describe('schemaToYargsOptions', () => {
3737
expect(coerce?.('23,18,14')).toEqual([23, 18, 14]);
3838
expect(coerce?.('23, 18, 14')).toEqual([23, 18, 14]);
3939
expect(coerce?.(['23', '18,14'])).toEqual([23, 18, 14]);
40-
expect(coerce?.('23,')).toEqual([23, Number.NaN]);
40+
expect(coerce?.('23,')).toEqual([23]);
4141
});
4242
});

src/cli/register-tool-commands.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,6 @@ function registerToolSubcommand(
298298
const outputStyle: OutputStyle = argv.style === 'minimal' ? 'minimal' : 'normal';
299299
const socketPath = argv.socket as string;
300300
const logLevel = argv['log-level'] as string | undefined;
301-
const style = argv.style as string | undefined;
302301
const filePathRenderStyle = argv.filePathRenderStyle as FilePathRenderStyle | undefined;
303302
const verboseOutput = argv.verbose === true;
304303

@@ -409,7 +408,7 @@ function registerToolSubcommand(
409408
runtime: 'cli',
410409
outputStyle,
411410
filePathRenderStyle,
412-
includeNextSteps: style !== 'minimal',
411+
includeNextSteps: outputStyle !== 'minimal',
413412
});
414413
const writeJsonlFragment =
415414
outputFormat === 'jsonl'

src/cli/schema-to-yargs.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ function coerceNumberArray(value: unknown): number[] {
1313
String(entry)
1414
.split(',')
1515
.map((item) => item.trim())
16-
.map((item) => (item === '' ? Number.NaN : Number(item))),
16+
.filter((item) => item !== '')
17+
.map((item) => Number(item)),
1718
);
1819
}
1920

0 commit comments

Comments
 (0)