Addition of ‘--work-dir’ option to override working directory, #1178 #1442
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.
Here I've started to work on this. Currently I've added
--work-dir
option represented byglobalWorkDir
inGlobalOpts
. Please correct me if this is a wrong place to put this option.Now my plan is:
Config
?), so functions that need to know stack working directory could query it. I thinkHasConfig env, MonadReader env
can be used.workDirRel
constant, use that value from config, this will probably addHasConfig, MonadReader env
or similar constraint to some functions that previously didn't need it.ignoreDirs
which specifies which directories shouldn't be searched for.cabal
files. It currently lists".stack-work"
. With this change it would need to construct the list more “dynamically”.My questions:
GlobalOpts
is the right place to add--work-dir
option?GlobalOpts
is the right place, where is the best place to pass the valueglobalWorkDir
fromGlobalOpts
toConfig
so the rest of Stack can query it?Well, the rest seems to be pretty easy to do (at least for now).