-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathgit.go
More file actions
52 lines (40 loc) · 955 Bytes
/
git.go
File metadata and controls
52 lines (40 loc) · 955 Bytes
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
package parser
import (
"fmt"
"github.com/deis/deis/client/cmd"
docopt "github.com/docopt/docopt-go"
)
// Git routes git commands to their specific function.
func Git(argv []string) error {
usage := `
Valid commands for git:
git:remote Adds git remote of application to repository
Use 'deis help [command]' to learn more.
`
switch argv[0] {
case "git:remote":
return gitRemote(argv)
case "git":
fmt.Print(usage)
return nil
default:
PrintUsage()
return nil
}
}
func gitRemote(argv []string) error {
usage := `
Adds git remote of application to repository
Usage: deis git:remote [options]
Options:
-a --app=<app>
the uniquely identifiable name for the application.
-r --remote=REMOTE
name of remote to create. [default: deis]
`
args, err := docopt.Parse(usage, argv, true, "", false, true)
if err != nil {
return err
}
return cmd.GitRemote(safeGetValue(args, "--app"), args["--remote"].(string))
}