Skip to content

Commit

Permalink
Removing noColor option
Browse files Browse the repository at this point in the history
  • Loading branch information
zendern committed Feb 27, 2020
1 parent 9ae19b1 commit e6ae48c
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 12 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ Options:
Path to a file containing newline separated CVEs to be excluded (default "./.nancy-ignore")
-no-color
indicate output should not be colorized
-noColor
indicate output should not be colorized (deprecated: please use no-color)
-quiet
indicate output should contain only packages with vulnerabilities
-version
Expand Down
9 changes: 0 additions & 9 deletions configuration/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@ var unixComments = regexp.MustCompile(`#.*$`)
func Parse(args []string) (Configuration, error) {
config := Configuration{}
var excludeVulnerabilityFilePath string
var noColorDeprecated bool

flag.BoolVar(&config.Help, "help", false, "provides help text on how to use nancy")
flag.BoolVar(&config.NoColor, "no-color", false, "indicate output should not be colorized")
flag.BoolVar(&noColorDeprecated, "noColor", false, "indicate output should not be colorized (deprecated: please use no-color)")
flag.BoolVar(&config.Quiet, "quiet", false, "indicate output should contain only packages with vulnerabilities")
flag.BoolVar(&config.Version, "version", false, "prints current nancy version")
flag.BoolVar(&config.CleanCache, "clean-cache", false, "Deletes local cache directory")
Expand All @@ -56,13 +54,6 @@ func Parse(args []string) (Configuration, error) {
config.Path = args[len(args)-1]
}

if noColorDeprecated == true {
fmt.Println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
fmt.Println("!!!! DEPRECATION WARNING : Please change 'noColor' param to be 'no-color'. This one will be removed in a future release. !!!!")
fmt.Println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
config.NoColor = noColorDeprecated
}

err = getCVEExcludesFromFile(&config, excludeVulnerabilityFilePath)
if err != nil {
return config, err
Expand Down
1 change: 0 additions & 1 deletion configuration/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ CVN-543`)
"defaults": {args: []string{"/tmp/go.sum"}, expectedConfig: Configuration{NoColor: false, Quiet: false, Version: false, CveList: types.CveListFlag{}, Path: "/tmp/go.sum"}, expectedErr: nil},
"help": {args: []string{"-help", "/tmp/go2.sum"}, expectedConfig: Configuration{Help: true, NoColor: false, Quiet: false, Version: false, CveList: types.CveListFlag{}, Path: "/tmp/go2.sum"}, expectedErr: nil},
"no color": {args: []string{"-no-color", "/tmp/go2.sum"}, expectedConfig: Configuration{NoColor: true, Quiet: false, Version: false, CveList: types.CveListFlag{}, Path: "/tmp/go2.sum"}, expectedErr: nil},
"no color (deprecated)": {args: []string{"-noColor", "/tmp/go2.sum"}, expectedConfig: Configuration{NoColor: true, Quiet: false, Version: false, CveList: types.CveListFlag{}, Path: "/tmp/go2.sum"}, expectedErr: nil},
"quiet": {args: []string{"-quiet", "/tmp/go3.sum"}, expectedConfig: Configuration{NoColor: false, Quiet: true, Version: false, CveList: types.CveListFlag{}, Path: "/tmp/go3.sum"}, expectedErr: nil},
"version": {args: []string{"-version", "/tmp/go4.sum"}, expectedConfig: Configuration{NoColor: false, Quiet: false, Version: true, CveList: types.CveListFlag{}, Path: "/tmp/go4.sum"}, expectedErr: nil},
"exclude vulnerabilities": {args: []string{"-exclude-vulnerability=CVE123,CVE988", "/tmp/go5.sum"}, expectedConfig: Configuration{NoColor: false, Quiet: false, Version: false, CveList: types.CveListFlag{Cves: []string{"CVE123", "CVE988"}}, Path: "/tmp/go5.sum"}, expectedErr: nil},
Expand Down

0 comments on commit e6ae48c

Please sign in to comment.