cargo-make icon indicating copy to clipboard operation
cargo-make copied to clipboard

Silent cargo make output but keep script output

Open janosimas opened this issue 1 year ago • 11 comments

Feature Description

I want to be able to get the output of a script without cargo make steps info.

Use case

This is useful for piping the output of a script to some other tool or to a file

Describe The Solution You'd Like

A flag for silencing cargo make output.

Current behavior

The current flags also affect the output of the script:

    --loglevel, -l <LOG LEVEL>
    --verbose, -v
    --quiet
    --silent

janosimas avatar Jul 24 '23 08:07 janosimas

I can't setup flags for every possible output variation. since its for scripts, you could manually pipe relevant parts to a yarget i side the script itself

sagiegurari avatar Jul 24 '23 10:07 sagiegurari

I can't setup flags for every possible output variation.

That is not what I meant. What I expected was to be able to control the log level exclusively of cargo make. The current behavior is quite limiting as it is a global option.

since its for scripts, you could manually pipe relevant parts to a yarget i side the script itself

In that case I would need a different target for every pipeline. If i need to edit an output with awk, I would need a new target for every type of change I want to do.

janosimas avatar Jul 24 '23 13:07 janosimas

This was also one of the first things I reacted over when trying out this project. I strongly dislike the verbose unrelated output.

silven avatar Sep 27 '23 13:09 silven

@silven you have both --quiet and --silent to make output very minimal/off

sagiegurari avatar Sep 27 '23 15:09 sagiegurari

closing due to lack of feedback

sagiegurari avatar Dec 15 '23 15:12 sagiegurari

I agree this is very unusual behavior. I would expect cargo-make's log output to be on stderr (this is what make does). But barring that, I would expect --quiet/--silent to suppress only the output of cargo-make itself, and not the commands' output.

As it is currently, there is no way to generally run a task and pipe it's output somewhere. One such use-case is to set VSCode to use a cargo-make task as the formatter, so that we can manage using a specific rustfmt nightly in one place. This requires the stdout of the task to only contain the formatted file, which simply isn't possible without invoking some intermediary shell script with a bunch of text shuffling.

jdygert-spok avatar Jan 30 '24 18:01 jdygert-spok

@jdygert-spok the logging config is complex already as it is. i get people saying its too much, others too little, others complain on hard to troubleshoot due to things not logged out by default and so on.... its not possible to accommodate everyone. all i can say is maybe enable via cargo make duckscript plugin capability to setup logging per task....

sagiegurari avatar Feb 23 '24 16:02 sagiegurari

Here is another use case that cannot be done due to this surprising behavior. I expected to be able to configure VSCode workspace to use cargo make clippy instead of cargo clippy to check the code.

{
	"settings": {
		"rust-analyzer.check.overrideCommand": [
			"cargo",
			"make",
			"clippy",
			"--workspace",
			"--message-format=json",
			"--all-targets",
			"--tests",
		],
	}
}

Because the IDE expects a JSON output from that command (see: --message-format=json parameter), and only JSON output, this configuration is unusable.

koutheir avatar Jun 01 '24 05:06 koutheir

ya, its a bit tricky but will find some solution for this...

sagiegurari avatar Jun 01 '24 06:06 sagiegurari

Yep, already looking for alternatives to cargo make.

koutheir avatar Jun 01 '24 14:06 koutheir

Yep, already looking for alternatives to cargo make.

enjoy

sagiegurari avatar Jun 01 '24 18:06 sagiegurari