Skip to content

Commit b596aef

Browse files
VinGarciamakkes
andcommitted
Fix flux install command so it returns an error when unexpected arguments are passed
Co-authored-by: Max Jonas Werner <makkes@users.noreply.github.com> Signed-off-by: Vinícius Garcia <vingarcia00@gmail.com>
1 parent c5b5263 commit b596aef

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

cmd/flux/install.go

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import (
3636

3737
var installCmd = &cobra.Command{
3838
Use: "install",
39+
Args: cobra.NoArgs,
3940
Short: "Install or upgrade Flux",
4041
Long: `The install command deploys Flux in the specified namespace.
4142
If a previous version is installed, then an in-place upgrade will be performed.`,

cmd/flux/install_test.go

+5
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ func TestInstall(t *testing.T) {
3737
args: "install --namespace='@#[]'",
3838
assert: assertError("namespace must be a valid DNS label: \"@#[]\""),
3939
},
40+
{
41+
name: "invalid sub-command",
42+
args: "install unexpectedPosArg --namespace=example",
43+
assert: assertError(`unknown command "unexpectedPosArg" for "flux install"`),
44+
},
4045
}
4146

4247
for _, tt := range tests {

0 commit comments

Comments
 (0)