From a455e31df0c2afd201c8ac53f9cbbe5a9c0017e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20W=C3=A5reus?= Date: Tue, 10 Oct 2023 13:22:12 +0200 Subject: [PATCH] change to fingerprint instead of --no-fingerprint in scan command with default false --- internal/cmd/files/fingerprint/fingerprint.go | 8 +++++--- internal/cmd/scan/scan.go | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/internal/cmd/files/fingerprint/fingerprint.go b/internal/cmd/files/fingerprint/fingerprint.go index 4e4374a1..790115fa 100644 --- a/internal/cmd/files/fingerprint/fingerprint.go +++ b/internal/cmd/files/fingerprint/fingerprint.go @@ -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()) }, diff --git a/internal/cmd/scan/scan.go b/internal/cmd/scan/scan.go index 8b887f9a..71dcc683 100644 --- a/internal/cmd/scan/scan.go +++ b/internal/cmd/scan/scan.go @@ -32,7 +32,7 @@ const ( IntegrationFlag = "integration" ExclusionFlag = "exclusion" NoResolveFlag = "no-resolve" - NoFingerprintFlag = "no-fingerprint" + FingerprintFlag = "fingerprint" PassOnTimeOut = "pass-on-timeout" ) @@ -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) @@ -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),