From 59c935e72347c304fd49d312b40d6f52828fedb2 Mon Sep 17 00:00:00 2001 From: dwertent Date: Tue, 31 Aug 2021 09:00:52 +0300 Subject: [PATCH] update output f --- cautils/opapolicy/datastructures.go | 2 +- cmd/framework.go | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/cautils/opapolicy/datastructures.go b/cautils/opapolicy/datastructures.go index ef5183e7..1c897716 100644 --- a/cautils/opapolicy/datastructures.go +++ b/cautils/opapolicy/datastructures.go @@ -160,7 +160,7 @@ type ScanInfo struct { } func (scanInfo *ScanInfo) Init() { - scanInfo.setSilentMode() + // scanInfo.setSilentMode() scanInfo.setOutputFile() } diff --git a/cmd/framework.go b/cmd/framework.go index 94f61c7f..878c40ad 100644 --- a/cmd/framework.go +++ b/cmd/framework.go @@ -1,7 +1,6 @@ package cmd import ( - "errors" "flag" "fmt" "io" @@ -20,7 +19,7 @@ import ( ) var scanInfo opapolicy.ScanInfo -var supportedFrameworks = []string{"nsa", "mitre"} +var supportedFrameworks = []string{"nsa"} type CLIHandler struct { policyHandler *policyhandler.PolicyHandler @@ -34,10 +33,10 @@ var frameworkCmd = &cobra.Command{ ValidArgs: supportedFrameworks, Args: func(cmd *cobra.Command, args []string) error { if len(args) < 1 { - return errors.New("requires at least one argument") + return fmt.Errorf("requires at least one argument") } if !isValidFramework(args[0]) { - return errors.New(fmt.Sprintf("supported frameworks: %s", strings.Join(supportedFrameworks, ", "))) + return fmt.Errorf(fmt.Sprintf("supported frameworks: %s", strings.Join(supportedFrameworks, ", "))) } return nil }, @@ -76,7 +75,7 @@ func init() { scanCmd.AddCommand(frameworkCmd) scanInfo = opapolicy.ScanInfo{} frameworkCmd.Flags().StringVarP(&scanInfo.ExcludedNamespaces, "exclude-namespaces", "e", "", "namespaces to exclude from check") - frameworkCmd.Flags().StringVarP(&scanInfo.Format, "format", "f", "pretty-printer", "output format. supported formats: 'pretty-printer'/'json'/'junit'") + frameworkCmd.Flags().StringVarP(&scanInfo.Format, "format", "f", "pretty-printer", "output format. supported formats: `pretty-printer`/`json`/`junit`") frameworkCmd.Flags().StringVarP(&scanInfo.Output, "output", "o", "", "output file. print output to file and not stdout") frameworkCmd.Flags().BoolVarP(&scanInfo.Silent, "silent", "s", false, "silent progress output") }