juxt / mach

A remake of make (in ClojureScript)
246 stars 21 forks source link

Suppress stdout #28

Closed jonpither closed 7 years ago

jonpither commented 7 years ago

In Mach we have this tag literal #$ which does a shell from your Machfile (think Makefile) - i.e. #$ ["touch" "foo"]. It's cool.

Sometimes though you want to print the output stdout (as happens always now) but sometimes it's annoying and you want to suppress it.

Does an idiom shout out for this? For example we could add a new tag literal which is a quiet version... or change the contract of the literal to supply args... or add a Mach -v flag for verbose.

Thoughts welcome.

arichiardi commented 7 years ago

I'd do it per tag literal, as -v seems more useful when you want to debug your scripts (you log using console.log). Definitely worth having the feature.

jonpither commented 7 years ago

Thanks. Perhaps a new literal #@$ to suppress std out?

Since https://github.com/juxt/mach/commit/ec920075e2e82f9f64c366ac3c4c547aed7e0db8 the stdout and stderr from the shell process is redirected to the channels of the parent, mach process. This new literal would simply mute the outputs.

There is another thing printed currently, which is the actual command. The new literal could mute that too for simplicity.

jonpither commented 7 years ago

Or we simply allow users to call mach.core/sh and pass through opts if they want more control over what happens. This seems sensible to me.

arichiardi commented 7 years ago

The latter seems ok, probably no need to introduce a new literal...it seems fair to use the function directly if you need more fine tuning.