-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.js
executable file
·55 lines (45 loc) · 1.23 KB
/
main.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
#!/usr/bin/env node --harmony
//Main file that describes how each function is called
//Catches and displays errors, describes the helps option and version option
const program = require("commander");
const chalk = require("chalk");
const CommandActions = require("./command-actions/index");
program.command("print").action(function() {
CommandActions.print();
});
program
.command("set <file>")
.description("Sets the file to the filename provided")
.option("-a, --all", "List all files and folders")
.option("-l, --long", "")
.action(function(file) {
CommandActions.set(file);
});
program
.command("list")
.description("List avaiable files")
.action(function() {
CommandActions.list();
});
program
.command("feedback")
.description("Allows users to give feedback")
.action(function() {
CommandActions.feedback();
});
program.on("command:*", function() {
console.error(
chalk.red(
"Invalid command: "+program.args.join()+"\nSee --help for a list of available commands.",
)
);
process.exit(1);
});
program.option("-v, --Version", "Prints out the version number");
program.parse(process.argv);
if (program.Version) {
CommandActions.logo();
}
if (program.args.length < 1 && !program.Version) {
CommandActions.print();
}