-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
43 lines (40 loc) · 770 Bytes
/
main.go
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
package main
import (
"fmt"
"os"
"github.com/antoniszczepanik/gggit/cmds"
"github.com/antoniszczepanik/gggit/common"
)
func main() {
if len(os.Args) < 2 {
common.Usage("You need to specify a gggit command.")
}
cmd := os.Args[1]
args := os.Args[2:]
switch cmd {
case "add":
cmds.Add(args)
case "branch":
cmds.Branch(args)
case "cat-file":
cmds.Cat(args)
case "checkout":
cmds.Checkout(args)
case "commit":
cmds.Commit(args)
case "hash-object":
cmds.Hash(args)
case "init":
cmds.Init(args)
case "log":
cmds.Log(args)
case "ls-tree":
cmds.Ls(args)
case "ls-objects":
cmds.LsObjects(args)
case "status":
cmds.Status(args)
default:
common.Usage(fmt.Sprintf("Command %v is not available. Did you mean sth else?\n", cmd))
}
}