-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
31 lines (26 loc) · 792 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
package main
import (
"flag"
"fmt"
"os"
"path"
"strings"
)
var workingDir = flag.String("w", ".", "set the working directory")
var depth = flag.Int("d", 1, "depth of folders to look into for git repositories")
var noGroup = flag.Bool("no-group", false, "do not group same outputs")
var noColor = flag.Bool("no-color", false, "do not print color characters")
func main() {
flag.Parse()
var commands = flag.Args()
var workingDir = path.Clean(*workingDir)
repos, err := Repos(workingDir, 1, *depth)
if err != nil {
fmt.Fprintf(os.Stderr, "failed to get git repos: %v\n", err)
os.Exit(1)
}
if err = run(commands, repos, workingDir, !*noGroup, !*noColor); err != nil {
fmt.Fprintf(os.Stderr, "failed to run git %s: %v\n", strings.Join(commands, " "), err)
os.Exit(1)
}
}