-
Notifications
You must be signed in to change notification settings - Fork 21
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
added customized help command #850
Conversation
✅ Deploy Preview for kusk-docs-preview canceled.
|
Signed-off-by: jasmingacic <jasmin.gacic@gmail.com>
Co-authored-by: Abdallah Abedraba <aabedraba@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Ran the commands and saw the output as attached in the screenshots.
reportError(err) | ||
return err | ||
} | ||
kuskui.PrintStart("kusk upgraded") | ||
} | ||
} | ||
|
||
if err := utils.WaitForPodsReady(cmd.Context(), c, namespace, name, time.Duration(5*time.Minute), "component"); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor point, but this looks very similar to:
if err := utils.WaitForPodsReady(cmd.Context(), c, namespace, "envoy", time.Duration(5*time.Minute), "component"); err != nil {
envoyFleetSpinner.Fail("Failed upgrading EnvoyFleet", err.Error())
reportError(err)
return err
}
Perhaps in the future move this into a separate function?
cmd/kusk/cmd/root.go
Outdated
func help(c *cobra.Command, s []string) { | ||
|
||
switch c.Use { | ||
case "mock": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot you not use the .Use
field in the different commands instead of string
s in the case
statements? E.g.,
case mockCmd.Use
Would work here I believe?
If it doesn't work, I'd just leave it as-is.
@@ -128,20 +79,20 @@ $ kusk mock -i https://url.to.api.com | |||
if err != nil { | |||
err := fmt.Errorf("unable to fetch user's home directory: %w", err) | |||
reportError(err) | |||
ui.Fail(err) | |||
kuskui.PrintError(err.Error()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you not just make this take an error
object?
I see kuskui.PrintError(err.Error())
being repeated in a lot of places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Print error accepts array of strings which is usually practical for constructing different error messages. So i'd leave it like this
added spinner to the install command
fixes #668
fixes #670