Merge pull request #156 from Bezbran/dev

fix  --help flag
This commit is contained in:
Bezbran
2021-10-14 10:55:43 +03:00
committed by GitHub
3 changed files with 7 additions and 8 deletions
+7 -3
View File
@@ -13,10 +13,17 @@ import (
var cfgFile string
var armoBEURLs = ""
const envFlagUsage = "Send report results to specific URL. Format:<ReportReceiver>,<Backend>,<Frontend>.\n\t\tExample:report.armo.cloud,api.armo.cloud,portal.armo.cloud"
var rootCmd = &cobra.Command{
Use: "kubescape",
Short: "Kubescape is a tool for testing Kubernetes security posture",
Long: `Kubescape is a tool for testing Kubernetes security posture based on NSA \ MITRE ATT&CK® specifications.`,
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
flag.Parse()
InitArmoBEConnector()
return nil
},
}
func Execute() {
@@ -36,9 +43,6 @@ func initConfig() {
}
func InitArmoBEConnector() {
if armoBEURLs == "" && rootCmd.Flag("environment") != nil {
armoBEURLs = rootCmd.Flag("environment").Value.String()
}
urlSlices := strings.Split(armoBEURLs, ",")
if len(urlSlices) > 3 {
glog.Errorf("Too many URLs")
-2
View File
@@ -4,8 +4,6 @@ import (
"github.com/spf13/cobra"
)
const envFlagUsage = "Send report results to specific URL. Format:<ReportReceiver>,<Backend>,<Frontend>.\n\t\tExample:report.armo.cloud,api.armo.cloud,portal.armo.cloud"
// scanCmd represents the scan command
var scanCmd = &cobra.Command{
Use: "scan",
-3
View File
@@ -1,7 +1,6 @@
package main
import (
"flag"
"fmt"
"os"
@@ -10,8 +9,6 @@ import (
func main() {
CheckLatestVersion()
flag.Parse()
cmd.InitArmoBEConnector()
cmd.Execute()
}