WillAbides / kongplete

MIT License
30 stars 9 forks source link

add --shell parameter #18

Open charlesdaniels opened 1 year ago

charlesdaniels commented 1 year ago

This allows the user of the install-completions subcommand to override the detected shell and explicitly use one of the 3 supported options.

I also removed the Uninstall field from the subcommand, because unused.

ReillyBrogan commented 9 months ago

@WillAbides @charlesdaniels could we get this PR rebased and merged? I came here because syncthing recently added completions using this library, and as a Linux distribution package maintainer I want to generate all shell completions during the package build so that they work out-of-the-box when a user installs the package. This doesn't seem to be possible using this library without modifying the build users login shell which is often impossible in build environments due to sandboxing constraints.

Frankly, checking for the login shell is a bad choice for detection on Linux. It would be far more idiomatic to check the SHELL environmental variable which should always contain the value of the current shell. Otherwise a user could have fish as their login shell and start a bash shell and the generated completions wouldn't work with bash.

charlesdaniels commented 9 months ago

Totally forgot about this, I never got a PR review. I would be happy to rebase this and address any feedback if @WillAbides is interested in having this merged.