-
Notifications
You must be signed in to change notification settings - Fork 846
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
tab completion for stack build and exec targets #1343
Comments
Agreed, this would be very nice to have. |
The bash file for Cabal is here |
We actually have bash completion via optparse-applicative: https://github.com/pcapriotti/optparse-applicative/wiki/Bash-Completion These just need to be extended to have more stack specific smarts, which would be really excellent! I miss having this all the time. I'm actually rather baffled why this guide recommends passing
@borsboom Maybe we should document how to install these completions? And maybe our ubuntu package shouldn't use the absolute path to stack for the script? This way if you're using a locally upgraded stack, you will get updated completions. |
Setting up bash completion is documented here: You're probably right about not using the absolute path in the Linux On Sat, Nov 21, 2015 at 12:29 AM Michael Sloan notifications@github.com
|
(I've updated the docs and distro package builders to just use |
I'll give this one a shot since it looks like it's been open for a while and hasn't been picked up. |
Awesome! :D While I don't want to overload you with complex considerations, it might also be worth considering how this would work with #1748 |
Absolutely! I was just reading up on optparser-applicative auto complete, and it seems it should work for all those scenarios as well. |
It seems that an environment needs to be set before we can fetch the build targets. However, the target actually gets checked when the build command is run. Should I just assume the environment to be local by default for the autocomplete? This would mean that unless you are in the same directory as your |
Yeah, that's the primary trickiness of this - we need to load up the configuration and parse the cabal files (since for full target completion we also need to know the compontents of the cabal files). I'd say it's reasonable to:
Bonus points would be to rely on the cabal file name matching the package name, and only parse it when it looks like the user is trying to complete to a component (e.g. they're asking for completions of |
Implemented! |
I would like to be able to do
stack build <tab>
and see the build targets like:This is something which I'm used to in cabal which I really miss in stack.
Then I'd like to see the executables within each library, like:
I think the same feature would be useful for
stack exec
. With cabal I do./dist/build/<tab>
The text was updated successfully, but these errors were encountered: