feat: default value for option

This commit is contained in:
Eli Bosley
2025-01-27 09:55:34 -05:00
parent e33c7583f7
commit 632775e435

View File

@@ -5,7 +5,7 @@ import { ECOSYSTEM_PATH, PM2_PATH } from '@app/consts';
import { LogService } from '@app/unraid-api/cli/log.service'; import { LogService } from '@app/unraid-api/cli/log.service';
interface LogsOptions { interface LogsOptions {
lines: number lines: number;
} }
@Command({ name: 'logs' }) @Command({ name: 'logs' })
@@ -14,9 +14,8 @@ export class LogsCommand extends CommandRunner {
super(); super();
} }
@Option({ flags: '-l, --lines', description: 'Number of lines to tail'}) @Option({ flags: '-l, --lines <lines>', description: 'Number of lines to tail', defaultValue: 100 })
parseLines(input: string): number parseLines(input: string): number {
{
const parsedValue = parseInt(input); const parsedValue = parseInt(input);
return Number.isNaN(parsedValue) ? 100 : parsedValue; return Number.isNaN(parsedValue) ? 100 : parsedValue;
} }