mirror of
https://github.com/trufflesecurity/trufflehog.git
synced 2024-11-10 07:04:24 +00:00
Add flag to get information if trufflehog being ran from TUI (#1644)
* Add flag to get information if trufflehog being ran from TUI Co-authored-by: mcastorina <m.castorina93@gmail.com> * Always use version.BuildVersion --------- Co-authored-by: mcastorina <m.castorina93@gmail.com>
This commit is contained in:
parent
024b219dfb
commit
c1a2019d5b
2 changed files with 11 additions and 8 deletions
5
main.go
5
main.go
|
@ -195,6 +195,8 @@ var (
|
|||
jenkinsUsername = jenkinsScan.Flag("username", "Jenkins username").Envar("JENKINS_USERNAME").String()
|
||||
jenkinsPassword = jenkinsScan.Flag("password", "Jenkins password").Envar("JENKINS_PASSWORD").String()
|
||||
jenkinsInsecureSkipVerifyTLS = jenkinsScan.Flag("insecure-skip-verify-tls", "Skip TLS verification").Envar("JENKINS_INSECURE_SKIP_VERIFY_TLS").Bool()
|
||||
|
||||
usingTUI = false
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
@ -220,6 +222,7 @@ func init() {
|
|||
// Overwrite the Args slice so overseer works properly.
|
||||
os.Args = os.Args[:1]
|
||||
os.Args = append(os.Args, args...)
|
||||
usingTUI = true
|
||||
}
|
||||
|
||||
cmd = kingpin.MustParse(cli.Parse(os.Args[1:]))
|
||||
|
@ -259,7 +262,7 @@ func main() {
|
|||
}
|
||||
|
||||
if !*noUpdate {
|
||||
updateCfg.Fetcher = updater.Fetcher(version.BuildVersion)
|
||||
updateCfg.Fetcher = updater.Fetcher(usingTUI)
|
||||
}
|
||||
if version.BuildVersion == "dev" {
|
||||
updateCfg.Fetcher = nil
|
||||
|
|
|
@ -19,16 +19,14 @@ import (
|
|||
"github.com/trufflesecurity/trufflehog/v3/pkg/version"
|
||||
)
|
||||
|
||||
func Fetcher(version string) fetcher.Interface {
|
||||
return &OSS{
|
||||
CurrentVersion: version,
|
||||
}
|
||||
func Fetcher(tui bool) fetcher.Interface {
|
||||
return &OSS{TUI: tui}
|
||||
}
|
||||
|
||||
type OSS struct {
|
||||
Interval time.Duration
|
||||
CurrentVersion string
|
||||
Updated bool
|
||||
Interval time.Duration
|
||||
TUI bool
|
||||
Updated bool
|
||||
}
|
||||
|
||||
// Init validates the provided config
|
||||
|
@ -43,6 +41,7 @@ type FormData struct {
|
|||
OS string
|
||||
Arch string
|
||||
CurrentVersion string
|
||||
TUI bool
|
||||
Timezone string
|
||||
Binary string
|
||||
}
|
||||
|
@ -59,6 +58,7 @@ func (g *OSS) Fetch() (io.Reader, error) {
|
|||
OS: runtime.GOOS,
|
||||
Arch: runtime.GOARCH,
|
||||
CurrentVersion: version.BuildVersion,
|
||||
TUI: g.TUI,
|
||||
Timezone: zone,
|
||||
Binary: "trufflehog",
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue