zarf icon indicating copy to clipboard operation
zarf copied to clipboard

Investigate implementing Cobra Suggestions

Open Racer159 opened this issue 1 year ago • 2 comments

Is your feature request related to a problem? Please describe.

Currently we display help and an error when a Zarf command or flag is inputted incorrectly. This is somewhat helpful but doesn't always guide the user toward what they want to do.

Describe the solution you'd like

We should investigate Cobra suggestions to help with the UX around mistyped commands (and flags) if possible. https://cobra.dev/#suggestions-when-unknown-command-happens

Describe alternatives you've considered

We could manually write our own distance functions and checks but this would not be ideal.

Additional context

This would help with the UX of the CLI for deploy users who may not be familiar with Zarf or command lines.

Racer159 avatar Apr 20 '23 00:04 Racer159

@Noxsios [2 minutes ago] Making sure each command has a help message + examples is also useful

Racer159 avatar Apr 20 '23 00:04 Racer159

Getting cobra to do this for us relies upon us not using cmd.Run + message.Fatal in our commands. I lean more towards this anyways as that is a more true CLI experience + it stops os.Exits when zarf's CMD is embedded.

Noxsios avatar Mar 07 '24 06:03 Noxsios