cabal icon indicating copy to clipboard operation
cabal copied to clipboard

cabal new-run: Do not print `Up to date`

Open nomeata opened this issue 7 years ago • 8 comments

I use cabal new-run in scripts within my project to call the program that I am developing there, e.g. in the test suite. This is great, because it means I never accidentally test an old binary (my colleagues have to remember running stack build before running the test suite).

But now every invocation prints Up to date, which is a bit annoying and odd-looking in the build log. Would it be unreasonable to skip printing that?

nomeata avatar Jan 03 '18 12:01 nomeata

See also #4789, which seems to be a more general solution.

23Skidoo avatar Jan 03 '18 12:01 23Skidoo

I guess personally, I don’t even want the Up to date on stderr (it’d still show up in the terminal as I run these scripts). But of course that’s subjective.

nomeata avatar Jan 03 '18 14:01 nomeata

How about cabal -v0 new-run? That's what I use.

peti avatar Jan 03 '18 15:01 peti

I’ll have a look :-) … I guess that is good enough for me, so if others find the output useful, I’ll go with that.

nomeata avatar Jan 03 '18 15:01 nomeata

I was about to report this again, only to find that I have reported before.

I'm sitting in a MuniHac workshop and was just annoyed by that string in the presenter's command output. My impression is that with the proliferation of cabal run, it's a more relevant paper cut these days.

So can we maybe remove that message in the default verbosity level?

nomeata avatar Oct 08 '22 12:10 nomeata

I fully support removing it in the default verbosity. Will approve a PR if anyone gets to it. I think it’s a matter of changing notice for info here: https://github.com/haskell/cabal/blob/519d2b444b45765ecca13dd515490a6a69750a8f/cabal-install/src/Distribution/Client/ProjectOrchestration.hs#L875

ulysses4ever avatar Oct 08 '22 13:10 ulysses4ever

One issue though is that it’s probably not possible under the current architecture to be sensitive to whether you run v2-run or v2-build, and for the latter I think we’d want to see “Up to date”. So maybe I was too hasty in the previous message.

ulysses4ever avatar Oct 08 '22 13:10 ulysses4ever

It seems like to address build v. run difference, one could add a Distribution.Client.ProjectOrchestration.CurrentCommand parameter to printPlan (and extend CurrentCommand with RunCommand).

ulysses4ever avatar Oct 08 '22 13:10 ulysses4ever

Any volunteers, please? We'd help, promise. :)

Mikolaj avatar Oct 31 '22 13:10 Mikolaj

@Mikolaj I'm up for it

cbclemmer avatar Oct 31 '22 15:10 cbclemmer

@cbclemmer that's good to hear, thank you. What I wrote above about distinguishing run vs. build, I think, still stands, although you not necessarily need to extend the CurrentCommand type with run because build seems to be the only reasonable exception to the general rule (don't show Up to date). Therefore, inside printPlan you can just say: print the message only if the current command is build.

ulysses4ever avatar Oct 31 '22 15:10 ulysses4ever