-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcli.js
78 lines (67 loc) · 1.71 KB
/
cli.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env node
const { Command } = require("commander");
const program = new Command();
const { Action } = require("./action");
program
.command("init")
.description(
"Initialize the data file where the repository and its data are stored (no arguments)."
)
.action(() => {
Action.initAction();
});
program
.command("add <path>")
.description("Add a new repository (arguments: `path`).")
.action((path) => {
Action.addAction(path);
});
program
.command("last")
.description("Display the last opened repository (no arguments)")
.action(() => {
Action.lastAction();
});
program
.command("reset")
.description("Clear all repositories stored (no arguments)")
.action(() => {
Action.resetAction();
});
program
.command("list")
.description("List all repositories (no arguments).")
.action(() => {
Action.listAction();
});
program
.command("redirect <repoName>")
.description("Open specfic repo with his repoName (arguments: `repoName`)")
.action((repoName) => {
Action.redirectAction(repoName);
});
program
.command("find <repoName>")
.description(
"Find for a repository to get its information by repoName (argument: `repoName`)"
)
.action((repoName) => {
Action.searchAction(repoName);
});
program
.command("remove <repoName>")
.description(
"Remove a specific repository by its repoName (arguments: `repoName`)"
)
.action((repoName) => {
Action.removeAction(repoName);
});
program
.command("update <repoName> <path>")
.description(
"Update the path of an existing repository (arguments: `repoName`, `path`)"
)
.action((repoName, path) => {
Action.updateAction(repoName, path);
});
program.parse(process.argv);