Skip to content

Commit

Permalink
change to fingerprint instead of --no-fingerprint in scan command wit…
Browse files Browse the repository at this point in the history
…h default false
  • Loading branch information
emilwareus committed Oct 10, 2023
1 parent e39017d commit 3a08735
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 5 additions & 3 deletions internal/cmd/files/fingerprint/fingerprint.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ const (
)

func NewFingerprintCmd(fingerprinter file.IFingerprint) *cobra.Command {

short := fmt.Sprintf("Fingerprint files for identification in a given path and writes it to %s. [beta feature]", file.OutputFileNameFingerprints)
long := fmt.Sprintf("Fingerprint files for identification in a given path and writes it to %s. [beta feature]\nThis hashes all files and matches them against the Debricked knowledge base.", file.OutputFileNameFingerprints)
cmd := &cobra.Command{
Use: "fingerprint [path]",
Short: "Fingerprint files for identification in a given path and writes it to " + file.OutputFileNameFingerprints,
Long: `Fingerprint files for identification in a given path.
This hashes all files and matches them against the Debricked knowledge base.`,
Short: short,
Long: long,
PreRun: func(cmd *cobra.Command, _ []string) {
_ = viper.BindPFlags(cmd.Flags())
},
Expand Down
6 changes: 3 additions & 3 deletions internal/cmd/scan/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const (
IntegrationFlag = "integration"
ExclusionFlag = "exclusion"
NoResolveFlag = "no-resolve"
NoFingerprintFlag = "no-fingerprint"
FingerprintFlag = "fingerprint"
PassOnTimeOut = "pass-on-timeout"
)

Expand Down Expand Up @@ -84,7 +84,7 @@ $ debricked scan . `+exampleFlags)
cmd.Flags().BoolVarP(&passOnDowntime, PassOnTimeOut, "p", false, "pass scan if there is a service access timeout")
cmd.Flags().BoolVar(&noResolve, NoResolveFlag, false, `disables resolution of manifest files that lack lock files. Resolving manifest files enables more accurate dependency scanning since the whole dependency tree will be analysed.
For example, if there is a "go.mod" in the target path, its dependencies are going to get resolved onto a lock file, and latter scanned.`)
cmd.Flags().BoolVar(&noFingerprint, NoFingerprintFlag, true, "disables fingerprinting for undeclared component identification. Can be run as a standalone command with more granular options.")
cmd.Flags().BoolVar(&noFingerprint, FingerprintFlag, false, "enables fingerprinting for undeclared component identification. Can be run as a standalone command [files fingerprint] with more granular options. [beta feature]")
viper.MustBindEnv(RepositoryFlag)
viper.MustBindEnv(CommitFlag)
viper.MustBindEnv(BranchFlag)
Expand All @@ -105,7 +105,7 @@ func RunE(s *scan.IScanner) func(_ *cobra.Command, args []string) error {
options := scan.DebrickedOptions{
Path: path,
Resolve: !viper.GetBool(NoResolveFlag),
Fingerprint: !viper.GetBool(NoFingerprintFlag),
Fingerprint: viper.GetBool(FingerprintFlag),
Exclusions: viper.GetStringSlice(ExclusionFlag),
RepositoryName: viper.GetString(RepositoryFlag),
CommitName: viper.GetString(CommitFlag),
Expand Down

0 comments on commit 3a08735

Please sign in to comment.