fix(cli): preserve stats cleanup lookback validation

- Parse the full inline lookback-days value before validation
This commit is contained in:
2026-08-11 22:31:56 -07:00
parent 046a87a826
commit 9fd2dfd7a0
2 changed files with 5 additions and 1 deletions
+2
View File
@@ -420,6 +420,8 @@ test('hasExplicitCommand and shouldStartApp preserve command intent', () => {
]).statsCleanupLookbackDays, ]).statsCleanupLookbackDays,
1, 1,
); );
assert.equal(parseArgs(['--stats-cleanup-lookback-days=30']).statsCleanupLookbackDays, 30);
assert.throws(() => parseArgs(['--stats-cleanup-lookback-days=30=oops']), /at least one day/);
const jellyfinLibraries = parseArgs(['--jellyfin-libraries']); const jellyfinLibraries = parseArgs(['--jellyfin-libraries']);
assert.equal(jellyfinLibraries.jellyfinLibraries, true); assert.equal(jellyfinLibraries.jellyfinLibraries, true);
+3 -1
View File
@@ -384,7 +384,9 @@ export function parseArgs(argv: string[]): CliArgs {
else if (arg === '--stats-cleanup-duplicate-lines') args.statsCleanupDuplicateLines = true; else if (arg === '--stats-cleanup-duplicate-lines') args.statsCleanupDuplicateLines = true;
else if (arg === '--stats-cleanup-dry-run') args.statsCleanupDryRun = true; else if (arg === '--stats-cleanup-dry-run') args.statsCleanupDryRun = true;
else if (arg.startsWith('--stats-cleanup-lookback-days=')) { else if (arg.startsWith('--stats-cleanup-lookback-days=')) {
args.statsCleanupLookbackDays = parseStatsCleanupLookbackDays(arg.split('=', 2)[1]); args.statsCleanupLookbackDays = parseStatsCleanupLookbackDays(
arg.slice('--stats-cleanup-lookback-days='.length),
);
} else if (arg === '--stats-cleanup-lookback-days') { } else if (arg === '--stats-cleanup-lookback-days') {
args.statsCleanupLookbackDays = parseStatsCleanupLookbackDays(readValue(argv[i + 1])); args.statsCleanupLookbackDays = parseStatsCleanupLookbackDays(readValue(argv[i + 1]));
} else if (arg.startsWith('--stats-response-path=')) { } else if (arg.startsWith('--stats-response-path=')) {