Debian Codegraph @

cmd/gitbatch/main.go

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 package main
2
3 import (
4 "fmt"
5 "os"
6
•7 "github.com/alecthomas/kingpin/v2"
8 "github.com/isacikgoz/gitbatch/internal/app"
9 )
10
11 func main() {
12 kingpin.Version("gitbatch version 0.6.1")
13
14 dirs := kingpin.Flag("directory", "Directory(s) to roam for git repositories.").Short('d').Strings()
15 mode := kingpin.Flag("mode", "Application start mode, more sensible with quick run.").Short('m').String()
16 recursionDepth := kingpin.Flag("recursive-depth", "Find directories recursively.").Default("0").Short('r').Int()
17 logLevel := kingpin.Flag("log-level", "Logging level; trace,debug,info,warn,error").Default("error").Short('l').String()
18 quick := kingpin.Flag("quick", "runs without gui and fetches/pull remote upstream.").Short('q').Bool()
19
20 kingpin.Parse()
21
22 if err := run(*dirs, *logLevel, *recursionDepth, *quick, *mode); err != nil {
23 fmt.Fprintf(os.Stderr, "application quitted with an unhandled error: %v", err)
24 os.Exit(1)
25 }
26 }
27
28 func run(dirs []string, log string, depth int, quick bool, mode string) error {
29 app, err := app.New(&app.Config{
30 Directories: dirs,
31 LogLevel: log,
32 Depth: depth,
33 QuickMode: quick,
34 Mode: mode,
35 })
36 if err != nil {
37 return err
38 }
39
40 return app.Run()
41 }