Skip to content

Commit f22f07f

Browse files
committed
fix: ensure path correctness
Previously we assumed that all args, that did not match any of our defined options, was paths which should be restructured. This lead to issues like #81 where a option was parsed as a path and the user isnt informed. Now the `cli` ensures that all paths is either a existing path or a glob.
1 parent 183ed70 commit f22f07f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/index.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import chalk from "chalk";
2+
import fs from "fs";
3+
import glob from "glob";
24
import { cosmiconfigSync } from "cosmiconfig";
35

46
import logger from "./shared/logger";
@@ -64,8 +66,11 @@ const parseArgs = (args: string[]): Args =>
6466
case "--write":
6567
acc.options.write = true;
6668
break;
67-
default:
68-
acc.rootPaths.push(arg);
69+
default: {
70+
if (fs.existsSync(arg) || glob.hasMagic(arg)) {
71+
acc.rootPaths.push(arg);
72+
}
73+
}
6974
}
7075

7176
return acc;

0 commit comments

Comments
 (0)