Skip to content

Commit f4e87bb

Browse files
committed
fix: resource cmd with no args panics
The logic I wrote to remap some resources to something else (organization membership to organization) for "resource commands" (like get, delete, edit) does not cover the use case where the first argument is omitted so it panics. For example: ``` datumctl get panic ``` With this fix it fallback to what the underline get command does (fails with a nice error)
1 parent 2631a7a commit f4e87bb

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

internal/cmd/utils.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ import (
66

77
func WrapResourceCommand(cmd *cobra.Command) *cobra.Command {
88
preRunFunc := func(cmd *cobra.Command, args []string) error {
9+
// if there are not args we let the underline command to deal with it.
10+
if len(args) == 0 {
11+
return nil
12+
}
913
// This mapping helps user during the getting started phase
1014
if args[0] == "organizations" || args[0] == "organization" {
1115
args[0] = "organizationmemberships"

0 commit comments

Comments
 (0)