Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cmd/flux/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ type getCommand struct {
}

func (get getCommand) run(cmd *cobra.Command, args []string) error {
if len(args) > 1 {
return fmt.Errorf("expected at most one resource name, got %d", len(args))
}

ctx, cancel := context.WithTimeout(context.Background(), rootArgs.timeout)
defer cancel()

Expand Down
5 changes: 5 additions & 0 deletions cmd/flux/get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ func Test_GetCmdErrors(t *testing.T) {
args: "get helmrelease -n " + tmpl["fluxns"],
assert: assertError(fmt.Sprintf("no HelmRelease objects found in \"%s\" namespace", tmpl["fluxns"])),
},
{
name: "rejects extra positional args",
args: "get sources git repo-a repo-b -n " + tmpl["fluxns"],
assert: assertError("expected at most one resource name, got 2"),
},
}

for _, tt := range tests {
Expand Down