-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathindex.js
executable file
·64 lines (64 loc) · 2.2 KB
/
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
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
#!/usr/bin/node
import { Command } from "commander";
import figlet from "figlet";
import { Init } from "./vc/init.js";
import { Add } from "./vc/stage.js";
import { Commit } from "./vc/commit.js";
import { Log } from "./vc/history.js";
import { Jump, List } from "./vc/branching.js";
import { Switch } from "./vc/Switch.js";
import { hardreset, softreset } from "./vc/reset.js";
const program = new Command();
program
.name("statik")
.version("1.1.0-alpha")
.description(figlet.textSync("Statik") + "\n An IPFS based version control system with static file hosting features");
program.command("init <ipfs_node_url>").description("Initialize a new Statik repository");
program.command("add [file_path]").description("Add a file to the Statik repository");
program.command("commit <message>").description("Commit changes to the Statik repository");
program.command("log").description("View the commit history of the current branch");
program.command("branch").description("List all branches in the Statik repository");
program.command("jump <branch>").description("Switch between branches");
program.command("switch <CID>").description("Switch between commits,switch <head> to jump to head commit'");
program.command("hardreset <CID>").description(" hard reset ");
program.command("softreset <CID>").description(" soft reset ");
program.parse(process.argv);
if (program.args.length < 1) {
program.outputHelp();
process.exit(0);
}
const cwd = process.cwd();
switch (program.args[0]) {
case "init":
const ipfs_node_url = program.args[1];
Init(cwd, ipfs_node_url);
break;
case "add":
Add(cwd, program.args.slice(1));
break;
case "commit":
Commit(cwd, program.args[1]);
break;
case "log":
Log(cwd);
break;
case "branch":
List(cwd);
break;
case "jump":
Jump(cwd, program.args[1]);
break;
case "switch":
Switch(cwd, program.args[1]);
break;
case "hardreset":
hardreset(program.args[1]);
break;
case "softreset":
softreset(program.args[1]);
break;
default:
program.outputHelp();
process.exit(0);
}
//# sourceMappingURL=index.js.map