Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[refactor][kubectl-plugin] require one posarg in session #3017

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

davidxia
Copy link
Contributor

command with Cobra's built-in cobra.ExactArgs(1) instead of writing our own
logic.

Before

$ kubectl ray session

Error: session (RAYCLUSTER | TYPE/NAME)
See 'ray session -h' for help and examples

After

$ kubectl ray session

Error: accepts 1 arg(s), received 0

Signed-off-by: David Xia [email protected]

Checks

  • I've made sure the tests are passing.
  • Testing Strategy
    • Unit tests
    • Manual tests
    • This PR is not tested :(

@davidxia davidxia force-pushed the patch41 branch 2 times, most recently from 838854d to e7b641e Compare February 11, 2025 21:39
@davidxia
Copy link
Contributor Author

We lose a little bit of info in the error message, but this might be worth being more Cobra-like and having net fewer lines of code.

command with Cobra's built-in `cobra.ExactArgs(1)` instead of writing our own
logic.

## Before

```console
$ kubectl ray session

Error: session (RAYCLUSTER | TYPE/NAME)
See 'ray session -h' for help and examples
```

## After

```console
$ kubectl ray session

Error: accepts 1 arg(s), received 0
```

Signed-off-by: David Xia <[email protected]>
@davidxia davidxia marked this pull request as ready for review February 11, 2025 22:22
@davidxia
Copy link
Contributor Author

cc @MortalHappiness

@andrewsykim
Copy link
Collaborator

Maybe it's just me, but I think the old output was more helpful

$ kubectl ray session

Error: session (RAYCLUSTER | TYPE/NAME)
See 'ray session -h' for help and examples

Because it showed what the missing required argument was

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.

2 participants