-
Notifications
You must be signed in to change notification settings - Fork 0
/
util.go
41 lines (36 loc) · 848 Bytes
/
util.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
package main
import (
"fmt"
"io"
"log"
"os"
"os/exec"
)
func ResolveRepoPath(repo string) string {
pwd, err := os.Getwd()
if err != nil {
log.Fatal(err)
}
return pwd + "/" + repo
}
func CreateCommand(name string, args ...string) *exec.Cmd {
cmd := exec.Command(name, args...)
return cmd
}
func AddOutsToCommand(cmd *exec.Cmd, stdout io.Writer, stderr io.Writer) {
cmd.Stdout = stdout
cmd.Stderr = stderr
}
func PrintUsage() {
fmt.Println("Usage:")
fmt.Println("gum prefix <url>")
fmt.Println("gum clone <repo>")
fmt.Println("gum checkout <branch>")
fmt.Println("gum switch <branch> [<branch>...]")
fmt.Println("gum pull <branch> [<branch>...]")
fmt.Println("gum commit [<file>...]")
fmt.Println("gum status")
fmt.Println("gum register <repo-path>")
fmt.Println("gum unregister <repo-path>")
fmt.Println("gum make")
}