ozil
ozil copied to clipboard
Don't provide silly suggestions for project binaries
We should already check if the help page exists and then provide it as a possible suggestion. The current behaviour is silly and results in lots of false positives.
EDIT: Turns out I was wrong. stack exec rg -- --help is perfectly fine.
The silly suggestion seems to be coming from the fact that stack actually doesn't do any input validation. If you give it some other binary which exists on your $PATH, it will just run it, no questions asked. Amazing. My guess is that it probably just temporarily modifies the environment to include the path to the project binaries and then runs the command. So for stack, we should probably search the binary folder.
For stack, we can run stack path. Look at the lines beginning with
project-root- this gives the absolute path for the project rootdist-dir- this gives the relative path for where the binaries might be
Then do a recursive search for the binary under project-root </> dist-dir.