-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Security Scan CLI Enhancements (#505)
* cleanup commands * update readme * flag handling * flag handling * add changelog * breaking change * fmt * use contextutils * simplify rseponse message * goimports -w
- Loading branch information
1 parent
1725f92
commit af8548e
Showing
15 changed files
with
675 additions
and
452 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,5 @@ vendor | |
|
||
# junit | ||
junit.xml | ||
|
||
_output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
changelog: | ||
- type: BREAKING_CHANGE | ||
issueLink: https://github.com/solo-io/go-utils/issues/469 | ||
resolvesIssue: false | ||
description: > | ||
Add scan-version command to CVE CLI which allows for easier scans of a single version (tag) | ||
of multiple images. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package cliutils | ||
|
||
import ( | ||
errors "github.com/rotisserie/eris" | ||
"github.com/spf13/cobra" | ||
"github.com/spf13/pflag" | ||
) | ||
|
||
type HideableFlag interface { | ||
MarkHidden(string) error | ||
} | ||
|
||
// MustMarkHidden panics if the call to MarkHidden() fails. | ||
func MustMarkHidden(flags HideableFlag, name string) { | ||
if err := flags.MarkHidden(name); err != nil { | ||
panic(err) | ||
} | ||
} | ||
|
||
// MustMarkFlagRequired panics if the call to MarkFlagRequired() fails. | ||
func MustMarkFlagRequired(flaggish interface{}, name string) { | ||
if err := MarkFlagRequired(flaggish, name); err != nil { | ||
panic(err) | ||
} | ||
} | ||
|
||
// MarkFlagRequired returns an error if the call to MarkFlagRequired() fails. | ||
func MarkFlagRequired(flaggish interface{}, name string) error { | ||
switch v := flaggish.(type) { | ||
case *cobra.Command: | ||
if err := v.MarkFlagRequired(name); err != nil { | ||
return err | ||
} | ||
case *pflag.FlagSet: | ||
if err := cobra.MarkFlagRequired(v, name); err != nil { | ||
return err | ||
} | ||
|
||
default: | ||
return errors.Errorf("Unknown flag type: %v", v) | ||
} | ||
return nil | ||
} | ||
|
||
// MustMarkPersistentFlagRequired panics if the call to MarkPersistentFlagRequired() fails. | ||
func MustMarkPersistentFlagRequired(cmd *cobra.Command, name string) { | ||
if err := cmd.MarkPersistentFlagRequired(name); err != nil { | ||
panic(err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.