-
Notifications
You must be signed in to change notification settings - Fork 25
/
commands.go
94 lines (74 loc) · 1.34 KB
/
commands.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
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package main
import (
"log"
"os"
"github.com/codegangsta/cli"
"fmt"
)
var Commands = []cli.Command{
command_clone,
command_merge_request,
command_merge,
command_show,
}
var command_clone = cli.Command{
Name: "clone",
Usage: "git lab clone <namescape/repository> [dir]",
Description: `
`,
Action: do_clone,
}
var command_merge_request = cli.Command{
Name: "merge-request",
Usage: "create merge request.",
Description: `
`,
Action: do_merge_request,
}
var command_merge = cli.Command{
Name: "merge",
Usage: "merge specified merge request.",
Description: `
`,
Action: do_merge,
}
var command_show = cli.Command{
Name: "show",
Usage: "show issue, merge request, wiki and repository",
Description: `
`,
Action: do_show,
}
func debug(v ...interface{}) {
if os.Getenv("DEBUG") != "" {
log.Println(v...)
}
}
func assert(err error) {
if err != nil {
log.Fatal(err)
}
}
func do_clone(c *cli.Context) {
remote := c.Args().Get(0)
local := c.Args().Get(1)
config := NewGlobalGitConfig()
client, e := NewGitLabClient(config)
if e != nil {
fmt.Println(e.Error())
return
}
ret, e := client.clone(remote, local)
if e != nil {
fmt.Println(e.Error())
}
if client != nil {
fmt.Println(ret)
}
}
func do_merge_request(c *cli.Context) {
}
func do_merge(c *cli.Context) {
}
func do_show(c *cli.Context) {
}