-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
35 lines (30 loc) · 954 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env node
import { program } from "commander";
import { Matcher } from "./lib/index.js";
import { debugLog } from "./lib/debug.js";
program
.name("duplifiler")
.description(
"A CLI tool which lists you files with the same name but a different extension"
)
.requiredOption("-e,--extensions [extensions]", "Extension seperated list")
.requiredOption("-p,--path [path]", "Path to scan")
.option(
"--ignore_pattern [ignore_pattern]",
"Pattern of folders to ignore in the search"
)
.parse(process.argv);
(async () => {
try {
const pathToScan = program.opts().path;
const matcher = new Matcher({
extensions: program.opts().extensions,
ignore_pattern_list: program.opts().ignore_pattern,
});
debugLog(`Starting search at ${pathToScan}`);
const results = await matcher.matchPatterns(pathToScan);
matcher.printResults(results);
} catch (error) {
console.log(error);
}
})();