mirror of
https://github.com/trufflesecurity/trufflehog.git
synced 2024-11-10 07:04:24 +00:00
Add metrics for command invocation (#3185)
This commit is contained in:
parent
8cf1ec2824
commit
97f8a4834b
2 changed files with 7 additions and 3 deletions
3
main.go
3
main.go
|
@ -299,7 +299,8 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if !*noUpdate {
|
if !*noUpdate {
|
||||||
updateCfg.Fetcher = updater.Fetcher(usingTUI)
|
topLevelCmd, _, _ := strings.Cut(cmd, " ")
|
||||||
|
updateCfg.Fetcher = updater.Fetcher(topLevelCmd, usingTUI)
|
||||||
}
|
}
|
||||||
if version.BuildVersion == "dev" {
|
if version.BuildVersion == "dev" {
|
||||||
updateCfg.Fetcher = nil
|
updateCfg.Fetcher = nil
|
||||||
|
|
|
@ -19,12 +19,13 @@ import (
|
||||||
"github.com/trufflesecurity/trufflehog/v3/pkg/version"
|
"github.com/trufflesecurity/trufflehog/v3/pkg/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Fetcher(tui bool) fetcher.Interface {
|
func Fetcher(cmd string, tui bool) fetcher.Interface {
|
||||||
return &OSS{TUI: tui}
|
return &OSS{Cmd: cmd, TUI: tui}
|
||||||
}
|
}
|
||||||
|
|
||||||
type OSS struct {
|
type OSS struct {
|
||||||
Interval time.Duration
|
Interval time.Duration
|
||||||
|
Cmd string
|
||||||
TUI bool
|
TUI bool
|
||||||
Updated bool
|
Updated bool
|
||||||
}
|
}
|
||||||
|
@ -41,6 +42,7 @@ type FormData struct {
|
||||||
OS string
|
OS string
|
||||||
Arch string
|
Arch string
|
||||||
CurrentVersion string
|
CurrentVersion string
|
||||||
|
Cmd string
|
||||||
TUI bool
|
TUI bool
|
||||||
Timezone string
|
Timezone string
|
||||||
Binary string
|
Binary string
|
||||||
|
@ -58,6 +60,7 @@ func (g *OSS) Fetch() (io.Reader, error) {
|
||||||
OS: runtime.GOOS,
|
OS: runtime.GOOS,
|
||||||
Arch: runtime.GOARCH,
|
Arch: runtime.GOARCH,
|
||||||
CurrentVersion: version.BuildVersion,
|
CurrentVersion: version.BuildVersion,
|
||||||
|
Cmd: g.Cmd,
|
||||||
TUI: g.TUI,
|
TUI: g.TUI,
|
||||||
Timezone: zone,
|
Timezone: zone,
|
||||||
Binary: "trufflehog",
|
Binary: "trufflehog",
|
||||||
|
|
Loading…
Reference in a new issue