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

Proposal: shell completion for --framework flag #61

Closed
MitchellBerend opened this issue Nov 11, 2023 · 2 comments
Closed

Proposal: shell completion for --framework flag #61

MitchellBerend opened this issue Nov 11, 2023 · 2 comments

Comments

@MitchellBerend
Copy link
Contributor

It would be nice if the completion command would also generate completion for the --framework flag. It will help with feature discovery for new users.

@basokant
Copy link
Contributor

Every Cobra CLI app has access to the

go-blueprint completion [bash/zsh/fish]

command, which generates shell completions.

HOWEVER, a bit of setup is required for permitted flag values in Cobra, which would be required to get autocomplete working for the --framework flag. See https://stackoverflow.com/questions/50824554/permitted-flag-values-for-cobra/70541824#70541824

  1. Make a new type that implements the pflag.Value interface, that is also a string enum (ie. frameworkEnum), which enumerates the possible frameworks that we support.
  2. Use enum in the registration of the create command. See init() function.
cmd.Flags().Var(&frameworkEnum, "framework", `framework. allowed: "chi", "standard library", "gin", etc...`)

@basokant
Copy link
Contributor

I might take this guy, will start working on it later tho so if anyone wants to work on it go ahead (check out the comment above for some tips from yours truly 😄)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants