Skip to content

Commit 7705b5b

Browse files
committed
fix: putout: -i
1 parent 9368f41 commit 7705b5b

File tree

4 files changed

+25
-14
lines changed

4 files changed

+25
-14
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
export function dropInteractive(argv) {
2+
const result = [];
3+
4+
for (const arg of argv) {
5+
if (arg === '-i' || arg === '--interactive')
6+
continue;
7+
8+
result.push(arg);
9+
}
10+
11+
return result;
12+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import {test} from 'supertape';
2+
import {dropInteractive} from './drop-interactive.mjs';
3+
4+
test('putout: bin: dropInteractive', (t) => {
5+
const result = dropInteractive(['-i']);
6+
const expected = [];
7+
8+
t.deepEqual(result, expected);
9+
t.end();
10+
});

packages/putout/bin/putout.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import cli from '../lib/cli/index.js';
1212
import {parseArgs} from '../lib/cli/parse-args.js';
1313
import {createExit} from '../lib/cli/exit.mjs';
1414
import {onDebuggerExit} from './debugger-exit.mjs';
15+
import {dropInteractive} from './drop-interactive.mjs';
1516

1617
const halt = process.exit;
1718
const logError = console.error;
@@ -62,7 +63,7 @@ workerData.push(...[
6263
await cli({
6364
write,
6465
halt,
65-
argv: workerData.slice(2),
66+
argv: dropInteractive(workerData.slice(2)),
6667
log,
6768
logError,
6869
readFile,

packages/putout/bin/tracer.mjs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import process, {
99
import {subscribe} from '@putout/engine-reporter/subscribe';
1010
import {parseArgs} from '../lib/cli/parse-args.js';
1111
import {createExit} from '../lib/cli/exit.mjs';
12+
import {dropInteractive} from './drop-interactive.mjs';
1213

1314
const args = parseArgs(process.argv.slice(2));
1415
const write = stdout.write.bind(stdout);
@@ -35,16 +36,3 @@ await subscribe({
3536
logError: console.error,
3637
}),
3738
});
38-
39-
function dropInteractive(argv) {
40-
const result = [];
41-
42-
for (const arg of argv) {
43-
if (arg === '-i' || arg === '--interactive')
44-
continue;
45-
46-
result.push(arg);
47-
}
48-
49-
return result;
50-
}

0 commit comments

Comments
 (0)