Merge pull request #264 from MatthewHink/mhink-container

Fix container build --all. #215.
This commit is contained in:
Gregory M. Kurtzer
2022-01-27 17:23:16 -08:00
committed by GitHub
2 changed files with 21 additions and 1 deletions

View File

@@ -0,0 +1,20 @@
package build
import (
"testing"
)
// TestArgsContainerBuild is a regression test for 215.
func TestArgsContainerBuild(t *testing.T) {
command := GetCommand()
err := command.Args(command, []string{})
if err != nil {
t.Errorf("no arguments to container build should succeed.")
}
err = command.Args(command, []string{"container1", "container2"})
if err != nil {
t.Errorf("multiple arguments to container build should succeed.")
}
}

View File

@@ -12,7 +12,7 @@ var (
Short: "(Re)build a bootable VNFS image",
Long: "This command will build a bootable VNFS image from imported CONTAINER image(s).",
RunE: CobraRunE,
Args: cobra.MinimumNArgs(1),
Args: cobra.ArbitraryArgs,
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
if len(args) != 0 {
return nil, cobra.ShellCompDirectiveNoFileComp