github.com/naphatkrit/deis@v1.12.3/client/parser/git.go (about) 1 package parser 2 3 import ( 4 "fmt" 5 6 "github.com/deis/deis/client/cmd" 7 docopt "github.com/docopt/docopt-go" 8 ) 9 10 // Git routes git commands to their specific function. 11 func Git(argv []string) error { 12 usage := ` 13 Valid commands for git: 14 15 git:remote Adds git remote of application to repository 16 17 Use 'deis help [command]' to learn more. 18 ` 19 20 switch argv[0] { 21 case "git:remote": 22 return gitRemote(argv) 23 case "git": 24 fmt.Print(usage) 25 return nil 26 default: 27 PrintUsage() 28 return nil 29 } 30 } 31 32 func gitRemote(argv []string) error { 33 usage := ` 34 Adds git remote of application to repository 35 36 Usage: deis git:remote [options] 37 38 Options: 39 -a --app=<app> 40 the uniquely identifiable name for the application. 41 -r --remote=REMOTE 42 name of remote to create. [default: deis] 43 ` 44 45 args, err := docopt.Parse(usage, argv, true, "", false, true) 46 47 if err != nil { 48 return err 49 } 50 51 return cmd.GitRemote(safeGetValue(args, "--app"), args["--remote"].(string)) 52 }