You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's --test-option/--test-options. I use it all the time for accepting the Haddock test suite (since v2-test does some more essential stuff that v2-run doesn't do).
Just wanted to say that I'd love to see this added as a feature.
btw --test-option(s) flushes the caches... the v2-run workaround is the only way to pass parameters in anything except the smallest of codebases. See #6114
Would this also solve Perhaps that would solve #6209 ?
I've been scouring the cabal-install codebase after an easy, yet non-disruptive, way to implement this feature using --. Turns out it is not possible for v2-test, as pointed out by @23Skidoo in #3638 (comment), all the arguments are just mangled together and then it's not possible anymore to know, with certainty, which argument is what. Unlike v2-run, that simply picks the first argument as a target and assume the rest as extra arguments, we can't do that for v2-test, because we have other possible flags in addition to the target.
Other than messing up with those lines in Main.hs, which could incur in a much much bigger rewrite, I'm out of ideas, anyone?
I'm afraid it does look disruptive and non-trivial, but OTOH it's obviously needed. I'm more worried about the spec, though. Do we have a uniform understanding of -- across all commands? E.g., what does expandResponse do? Are there other cases than v2-test that would treat -- specially? Does it conflict with expandResponse?
Alright, I gave using tuples a shot, and it was a terrible idea, a very big chunk of code goes around relying on the arguments as [String], and right now it wouldn't be worth it refactoring all that code; not even mentioning the unforeseen consequences of literally touching every command out there.
I was discussing with @fendor, and we concluded that the best approach would be to implement the -- behaviour in terms of --*-options, not literally, but conceptually. Considering that -- is used to pass arguments to a target executable, I propose:
The adoption of a generic --target-options flag, which could be called upon in two ways: directly using --target-options as a flag for a command; or using --, which then would be manually wired to --target-options (in the Main function, most likely); and
Deprecate the current --*-options flags, and while at that, they would all map to the new --target-options flag instead.
These would imply in much smaller changes, since it would rely on the flag machinery already in place.
Reacted by Francesco Gazzetta, Javier Neira and Mikolaj Konarski
Activity
m-renaud commentedon Aug 18, 2019
See #5416 for details. In summary, you need to use
cabal v2-run test:TARGET -- --foo.This isn't particularly intuitive, at the minimum the error message should be improved it link out to some external docs.
fgaz commentedon Aug 19, 2019
There's also a v2-test flag that adds arguments if I'm not mistaken
harpocrates commentedon Aug 19, 2019
There's
--test-option/--test-options. I use it all the time for accepting the Haddock test suite (sincev2-testdoes some more essential stuff thatv2-rundoesn't do).symbiont-sam-halliday commentedon Aug 29, 2019
Just wanted to say that I'd love to see this added as a feature.
btw
--test-option(s)flushes the caches... thev2-runworkaround is the only way to pass parameters in anything except the smallest of codebases. See #6114Would this also solve Perhaps that would solve #6209 ?
emilypi commentedon May 21, 2021
@ptkato this is a good one for you
ptkato commentedon Jun 7, 2021
I've been scouring the cabal-install codebase after an easy, yet non-disruptive, way to implement this feature using
--. Turns out it is not possible forv2-test, as pointed out by @23Skidoo in #3638 (comment), all the arguments are just mangled together and then it's not possible anymore to know, with certainty, which argument is what. Unlikev2-run, that simply picks the first argument as a target and assume the rest as extra arguments, we can't do that forv2-test, because we have other possible flags in addition to the target.Other than messing up with those lines in
Main.hs, which could incur in a much much bigger rewrite, I'm out of ideas, anyone?Mikolaj commentedon Jun 9, 2021
I'm afraid it does look disruptive and non-trivial, but OTOH it's obviously needed. I'm more worried about the spec, though. Do we have a uniform understanding of
--across all commands? E.g., what doesexpandResponsedo? Are there other cases thanv2-testthat would treat--specially? Does it conflict withexpandResponse?ptkato commentedon Jun 9, 2021
Kinda? It seems to be just ignored by every command, but other than that, not really.
I don't think modifications to
--would affectexpandResponsein any way, since they don't interact with each other.That's a valid concern, maybe we could rely on something like a tuple (as it is spit out by
break), or another custom type tailored to our needs.ptkato commentedon Jun 17, 2021
Alright, I gave using tuples a shot, and it was a terrible idea, a very big chunk of code goes around relying on the arguments as
[String], and right now it wouldn't be worth it refactoring all that code; not even mentioning the unforeseen consequences of literally touching every command out there.I was discussing with @fendor, and we concluded that the best approach would be to implement the
--behaviour in terms of--*-options, not literally, but conceptually. Considering that--is used to pass arguments to a target executable, I propose:--target-optionsflag, which could be called upon in two ways: directly using--target-optionsas a flag for a command; or using--, which then would be manually wired to--target-options(in the Main function, most likely); and--*-optionsflags, and while at that, they would all map to the new--target-optionsflag instead.These would imply in much smaller changes, since it would rely on the flag machinery already in place.