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

added customized help command #850

Merged
merged 12 commits into from
Oct 10, 2022
Merged

added customized help command #850

merged 12 commits into from
Oct 10, 2022

Conversation

jasmingacic
Copy link
Contributor

added spinner to the install command
fixes #668
fixes #670

added spinner to the install command
fixes #668
fixes #670
@netlify
Copy link

netlify bot commented Oct 8, 2022

Deploy Preview for kusk-docs-preview canceled.

Name Link
🔨 Latest commit b929856
🔍 Latest deploy log https://app.netlify.com/sites/kusk-docs-preview/deploys/6343fdf3e4d0460008758dce

Signed-off-by: jasmingacic <jasmin.gacic@gmail.com>
@jasmingacic
Copy link
Contributor Author

image
image
image
image
image
image

cmd/kusk/cmd/generate.go Outdated Show resolved Hide resolved
cmd/kusk/cmd/generate.go Show resolved Hide resolved
cmd/kusk/cmd/generate.go Outdated Show resolved Hide resolved
cmd/kusk/cmd/generate.go Outdated Show resolved Hide resolved
Copy link
Contributor

@mbana mbana left a 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 {
Copy link
Contributor

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?

func help(c *cobra.Command, s []string) {

switch c.Use {
case "mock":
Copy link
Contributor

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 strings 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())
Copy link
Contributor

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.

Copy link
Contributor Author

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

Signed-off-by: jasmingacic <jasmin.gacic@gmail.com>
Signed-off-by: jasmingacic <jasmin.gacic@gmail.com>
@jasmingacic jasmingacic merged commit 3bc22fb into main Oct 10, 2022
@jasmingacic jasmingacic deleted the ux_helpcmd branch October 10, 2022 11:24
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.

CLI Help: Add Getting Started to end of kusk install CLI: Updated kusk install UX
3 participants