-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.go
More file actions
38 lines (30 loc) · 761 Bytes
/
main.go
File metadata and controls
38 lines (30 loc) · 761 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
package main
import (
"fmt"
"os"
"github.com/spf13/cobra"
)
var (
verbose bool
debug bool
)
func main() {
cmd := &cobra.Command{
Use: "sane [OPTIONS] COMMAND [ARG...]",
Short: "Git repository structure validator",
TraverseChildren: true,
RunE: func(cmd *cobra.Command, args []string) error {
if len(args) == 0 {
return cmd.Help()
}
return fmt.Errorf("sane: %s is not a valid command", args[0])
},
}
cmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "Show verbose logs")
cmd.PersistentFlags().BoolVarP(&debug, "debug", "d", false, "Show debug logs")
cmd.AddCommand(newValidateCommand())
cmd.AddCommand(newVersionCommand())
if err := cmd.Execute(); err != nil {
os.Exit(1)
}
}