diff --git a/cli/app/app.go b/cli/app/app.go index 389722c2..26370b8b 100644 --- a/cli/app/app.go +++ b/cli/app/app.go @@ -74,6 +74,10 @@ func validateFlags(c *cli.Context, opt *kobject.ConvertOptions) { if len(dabFile) > 0 && c.GlobalIsSet("file") { logrus.Fatalf("Error: 'compose' file and 'dab' file cannot be specified at the same time") } + + if len(c.Args()) != 0 { + logrus.Fatal("Unknown Argument(s): ", strings.Join(c.Args(), ",")) + } } func validateControllers(opt *kobject.ConvertOptions) { diff --git a/script/test/cmd/tests.sh b/script/test/cmd/tests.sh index 08891d52..8edb7a25 100755 --- a/script/test/cmd/tests.sh +++ b/script/test/cmd/tests.sh @@ -72,4 +72,10 @@ convert::expect_success_and_warning "kompose --provider=openshift -f $KOMPOSE_RO # kubernetes test convert::expect_success_and_warning "kompose -f $KOMPOSE_ROOT/script/test/fixtures/envvars-separators/docker-compose.yml convert --stdout" "$KOMPOSE_ROOT/script/test/fixtures/envvars-separators/output-k8s.json" +###### +# Tests related to unknown arguments with cli commands +convert::expect_failure "kompose up $KOMPOSE_ROOT/script/test/fixtures/gitlab/docker-compose.yml" "Unknown Argument docker-gitlab.yml" +convert::expect_failure "kompose down $KOMPOSE_ROOT/script/test/fixtures/gitlab/docker-compose.yml" "Unknown Argument docker-gitlab.yml" +convert::expect_failure "kompose convert $KOMPOSE_ROOT/script/test/fixtures/gitlab/docker-compose.yml" "Unknown Argument docker-gitlab.yml" + exit $EXIT_STATUS