Use bash from $SHELL when it makes sense#408
Open
roberth wants to merge 1 commit intopcapriotti:masterfrom
Open
Use bash from $SHELL when it makes sense#408roberth wants to merge 1 commit intopcapriotti:masterfrom
roberth wants to merge 1 commit intopcapriotti:masterfrom
Conversation
Collaborator
|
Hi thanks for contributing to optparse! I'll be honest, I'm very conflicted on this, though happy to discuss further. What you've shown in your terminal printout is awful! We just regurgitate stderr of the base process into the user's shell when really, they don't want that. What I'm thinking is changing the bashCompleter :: String -> Completer
bashCompleter action = Completer $ \word -> do
let cmd = unwords ["compgen", "-A", action, "--", requote word]
(ec, _, result) <-
readProcessWithExitCode "bash" ["-c", cmd] ""
return $
if ec == ExitSuccess then
lines result
else
[]Here we get rid of a exception handler and won't spew error messages to their terminal when they hit tab. Your solution won't fix that in the general case, but could reduce it for some. I don't know, is that acceptable? |
Contributor
Author
|
A change like that will make it practically impossible to troubleshoot, unless someone is dead set on solving a minor inconvenience. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes file completion in cases where a virtual environment with a non-interactive bash is loaded with direnv, nix-shell or similar.
It solves the error: