Opt version (#80)

* version opt

* change-log
This commit is contained in:
Zachary Rice authored and GitHub committed 2018-07-22 20:16:09 -05:00
1 parent 851ea3df3c
commit 60801b336a
3 files changed
+60 -1

No files matched your search

+6
View File
@@ -92,6 +92,7 @@ type Options struct {
Verbose bool `short:"v" long:"verbose" description:"Show verbose output from gitleaks audit"`
Report string `long:"report" description:"path to write report file"`
Redact bool `long:"redact" description:"redact secrets from log messages and report"`
Version bool `long:"version" description:"version number"`
}
// Config struct for regexes matching and whitelisting
@@ -108,6 +109,7 @@ type Config struct {
}
}
const version = "1.1.2"
const defaultConfig = `
title = "gitleaks config"
# add regexes to the regex table
@@ -178,6 +180,10 @@ func main() {
repos []Repo
)
_, err := flags.Parse(&opts)
if opts.Version {
fmt.Println(version)
os.Exit(0)
}
if err != nil {
os.Exit(1)
}