PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: helm/helm (go)

Issue:
[helm3] unknown subcommand should return error
<!-- If you need help or think you have found a bug, please help us with your issue by entering the following information (otherwise you can delete this text): -->

The output of `helm version`:

```
version.BuildInfo{Version:"v3.0.0", GitCommit:"e29ce2a54e96cd02ccfce88bee4f58bb6e2a28b6", GitTreeState:"clean", GoVersion:"go1.13.4"}
```

There is no error raised if I passed an unknown subcommand to Helm 3, no error message and the exit code is 0.
It's really hard to find out what is going wrong when I was debugging a helm 2 plugin. there supposed to be an error message to tell me which subcommand does not exist.


Pull request:
Return "unknown command" error for unknown subcommands
Fix #6998

Patch:
diff --git a/cmd/helm/root.go b/cmd/helm/root.go
index 3c6a0d18e..3ebea3bae 100644
--- a/cmd/helm/root.go
+++ b/cmd/helm/root.go
@@ -26,7 +26,6 @@ import (
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"k8s.io/client-go/tools/clientcmd"
 
-	"helm.sh/helm/v3/cmd/helm/require"
 	"helm.sh/helm/v3/internal/completion"
 	"helm.sh/helm/v3/internal/experimental/registry"
 	"helm.sh/helm/v3/pkg/action"
@@ -77,7 +76,6 @@ func newRootCmd(actionConfig *action.Configuration, out io.Writer, args []string
 		Short:                  "The Helm package manager for Kubernetes.",
 		Long:                   globalUsage,
 		SilenceUsage:           true,
-		Args:                   require.NoArgs,
 		BashCompletionFunction: completion.GetBashCustomFunction(),
 	}
 	flags := cmd.PersistentFlags()


Test patch:
diff --git a/cmd/helm/root_test.go b/cmd/helm/root_test.go
index df592a96d..e1fa1fc27 100644
--- a/cmd/helm/root_test.go
+++ b/cmd/helm/root_test.go
@@ -95,3 +95,11 @@ func TestRootCmd(t *testing.T) {
 		})
 	}
 }
+
+func TestUnknownSubCmd(t *testing.T) {
+	_, _, err := executeActionCommand("foobar")
+
+	if err == nil || err.Error() != `unknown command "foobar" for "helm"` {
+		t.Errorf("Expect unknown command error, got %q", err)
+	}
+}