fix: argument validation for framework/control

This commit is contained in:
Avinash Upadhyaya
2022-02-23 10:24:14 +05:30
parent 40737d545b
commit 0d1c4cdc02
2 changed files with 8 additions and 4 deletions
+4 -2
View File
@@ -40,8 +40,10 @@ var controlCmd = &cobra.Command{
if len(args) > 0 {
controls := strings.Split(args[0], ",")
if len(controls) > 1 {
if controls[1] == "" {
return fmt.Errorf("usage: <control-0>,<control-1>")
for _, control := range controls {
if control == "" {
return fmt.Errorf("usage: <control-0>,<control-1>")
}
}
}
} else {
+4 -2
View File
@@ -51,8 +51,10 @@ var frameworkCmd = &cobra.Command{
if len(args) > 0 {
frameworks := strings.Split(args[0], ",")
if len(frameworks) > 1 {
if frameworks[1] == "" {
return fmt.Errorf("usage: <framework-0>,<framework-1>")
for _, framework := range frameworks {
if framework == "" {
return fmt.Errorf("usage: <framework-0>,<framework-1>")
}
}
}
} else {