-
Notifications
You must be signed in to change notification settings - Fork 463
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[refactor][kubectl-plugin] use cobra's posargs length validator (#2985)
We're currently validating the number of positional arguments ourselves. We can do this with `cobra.Command{Args: cobra.MaximumNArgs(1)}` instead to simplify logic. There are no functional changes. The error message changes slightly but still conveys the same information. ## Before ```console $ kubectl ray --context gke_kubeflow-platform_europe-west4-b_ml-compute-1 get cluster foo bar Error: too many arguments, either one or no arguments are allowed ``` ## After ```console $ kubectl ray get cluster foo bar Error: accepts at most 1 arg(s), received 2 ``` Signed-off-by: David Xia <[email protected]>
- Loading branch information
Showing
2 changed files
with
69 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters