diff --git a/src/index.ts b/src/index.ts index d2c67c1..b73f3db 100644 --- a/src/index.ts +++ b/src/index.ts @@ -64,8 +64,8 @@ program .description(` List all URLs in sitemap. `) - .option('--probability', 'the chance the line will pass', '10') - .action(() => { + .option('--probability ', 'the chance the line will pass', (value) => parseInt(value)) + .action((options) => { const rl = readline.createInterface({ input: process.stdin, output: process.stdout, @@ -75,7 +75,7 @@ program rl.on('line', (line) => { try { new URL(line); - if (Math.random() <= 0.1) { + if (Math.random() <= (options.probability / 100)) { console.log(line); } } catch {