-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.ts
More file actions
52 lines (50 loc) · 1.54 KB
/
Copy pathcli.ts
File metadata and controls
52 lines (50 loc) · 1.54 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import { cli, command } from "cleye";
import { collectHotSpots } from "./commands/hot-spots.js";
import { collectKnowledgeGaps } from "./commands/knowledge-gaps.js";
import { log } from "./console.js";
export class CommandLineInterface {
constructor() {}
public run() {
cli({
commands: [
command(
{
name: "hot-spots",
parameters: ["<path to repository>"],
},
async (argv) => {
const dir = argv._.pathToRepository;
log("Collecting files with most changes", dir);
await collectHotSpots(dir);
},
),
command(
{
name: "knowledge-gaps",
parameters: ["<path to repository>"],
flags: {
ignoreFiles: {
type: String,
description: "Which files to ignore in the output",
},
},
},
async (argv) => {
const dir = argv._.pathToRepository;
log("Collecting files with least number of contributors", dir);
let ignoreFilesPattern: string | null = null;
if (argv.flags.ignoreFiles) {
// eslint-disable-next-line no-console
console.log(
"will ignore the following files in the output: ",
argv.flags.ignoreFiles,
);
ignoreFilesPattern = argv.flags.ignoreFiles;
}
await collectKnowledgeGaps(dir, ignoreFilesPattern);
},
),
],
});
}
}