Skip to content

Commit 987bd71

Browse files
authored
Remove versionFlag in favor of setting the version flag with kingpin (#366)
This allows calling `trufflehog --version` without kingpin failing to parse the arguments.
1 parent b33376f commit 987bd71

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

main.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ import (
3232
var (
3333
cli = kingpin.New("TruffleHog", "TruffleHog is a tool for finding credentials.")
3434
cmd string
35-
debug = cli.Flag("debug", "Run in debug mode").Bool()
36-
versionFlag = cli.Flag("version", "Prints trufflehog version.").Bool()
35+
debug = cli.Flag("debug", "Run in debug mode.").Bool()
3736
jsonOut = cli.Flag("json", "Output in JSON format.").Short('j').Bool()
3837
jsonLegacy = cli.Flag("json-legacy", "Use the pre-v3.0 JSON format. Only works with git, gitlab, and github sources.").Bool()
3938
concurrency = cli.Flag("concurrency", "Number of concurrent workers.").Default(strconv.Itoa(runtime.NumCPU())).Int()
@@ -91,6 +90,7 @@ func init() {
9190
}
9291
}
9392

93+
cli.Version("trufflehog " + version.BuildVersion)
9494
cmd = kingpin.MustParse(cli.Parse(os.Args[1:]))
9595

9696
if *jsonOut {
@@ -127,11 +127,8 @@ func main() {
127127
}
128128

129129
func run(state overseer.State) {
130-
if *debug || *versionFlag {
130+
if *debug {
131131
fmt.Println("trufflehog " + version.BuildVersion)
132-
if *versionFlag {
133-
return
134-
}
135132
}
136133

137134
// When setting a base commit, chunks must be scanned in order.

0 commit comments

Comments
 (0)