flaggy icon indicating copy to clipboard operation
flaggy copied to clipboard

Add bash/zsh auto completion generation

Open integrii opened this issue 6 years ago • 3 comments

We should generate bash auto complete code when some pre-defined flag is specified. The flag should be able to be turned off if the user prefers that flag not be used by the system.

integrii avatar Mar 23 '18 07:03 integrii

Maybe rather a subcommand? Like './myApp installAutoCompletion'. Or make it configurable (app developer can choose between flag and subcommand, as well as change the flag and subcommand).

philippgille avatar Jul 11 '18 06:07 philippgille

I think a subcommand makes more sense for sure.

The main challenge I see here is not using a 3rd party package. I want to keep flaggy a zero dependency package.

integrii avatar Jul 11 '18 15:07 integrii

A possible approach to avoiding third party dependencies is implementing this feature in a separate package. I'm thinking of something like this:

  • All the command definitions (e.g.: in application code, not here) need to be moved out of the main package.
  • The third-party lib can read all of flaggy's commands and settings.
  • The third party lib generates the completions.

Note that the approach also allows having a separate binary that generates the completions, so the new library doesn't even need to be build into the application binary itself.

WhyNotHugo avatar Jan 16 '23 14:01 WhyNotHugo