Skip to content

Conversation

@gianarb
Copy link
Collaborator

@gianarb gianarb commented Jan 16, 2026

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)

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)
@gianarb gianarb requested a review from scotwells January 16, 2026 15:44
)

func WrapResourceCommand(cmd *cobra.Command) *cobra.Command {
preRunFunc := func(cmd *cobra.Command, args []string) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thoughts on just adding in this block?

if len(args) == 0 {
  return nil
}

That should make this more future proof so we don't make the same mistake if additional mappings are added. Maybe we also consider having a simple map that can be used to map resources.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants