Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Silent cargo make output but keep script output #901

Open
janosimas opened this issue Jul 24, 2023 · 11 comments
Open

Silent cargo make output but keep script output #901

janosimas opened this issue Jul 24, 2023 · 11 comments
Assignees

Comments

@janosimas
Copy link

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
@sagiegurari
Copy link
Owner

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

@janosimas
Copy link
Author

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.

@silven
Copy link

silven commented Sep 27, 2023

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

@sagiegurari
Copy link
Owner

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

@sagiegurari
Copy link
Owner

closing due to lack of feedback

@jdygert-spok
Copy link

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.

@sagiegurari sagiegurari reopened this Feb 23, 2024
@sagiegurari
Copy link
Owner

@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....

@koutheir
Copy link

koutheir commented Jun 1, 2024

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.

@sagiegurari
Copy link
Owner

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

@koutheir
Copy link

koutheir commented Jun 1, 2024

Yep, already looking for alternatives to cargo make.

@sagiegurari
Copy link
Owner

Yep, already looking for alternatives to cargo make.

enjoy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants