-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.go
More file actions
48 lines (39 loc) · 901 Bytes
/
main.go
File metadata and controls
48 lines (39 loc) · 901 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
39
40
41
42
43
44
45
46
47
48
package main
import (
"fmt"
"os"
"github.com/spf13/cobra"
"github.com/stackrox/ossls/cmd"
)
var (
version = "development"
)
func main() {
if err := mainCmd(); err != nil {
fmt.Fprintf(os.Stderr, "ossls: %s\n", err.Error())
os.Exit(1)
}
}
func mainCmd() error {
c := &cobra.Command{
SilenceErrors: true,
SilenceUsage: true,
}
c.PersistentFlags().StringP("config", "c", ".ossls.yml", "path to configuration file")
c.AddCommand(cmd.AuditCommand())
//c.AddCommand(cmd.ChecksumCommand())
//c.AddCommand(cmd.ListCommand())
//c.AddCommand(cmd.NoticeCommand())
//c.AddCommand(cmd.ScanCommand())
c.AddCommand(versionCommand())
return c.Execute()
}
func versionCommand() *cobra.Command {
return &cobra.Command{
Use: "version",
Short: fmt.Sprintf("Displays the version (%s) and exits", version),
Run: func(*cobra.Command, []string) {
fmt.Println(version)
},
}
}