Closed LeResKP closed 10 months ago
Hi there, thanks for suggesting an improvement!
What kind of error do you mean? What are you trying to accomplish?
I'm talking about the _info that templates were perfects or have been reindented
_info(f"{changed_files} template{s} {have} been reindented.")
_info(f"{unchanged_files} template{s} {were} already perfect!")
It's not an error since it's info, but it's printed on sys.stderr. But I wouln't print them on sys.stdout since in some case the content is passed as stdin.
My goal is to fix the the djhtml-vscode plugin : https://github.com/tomusher/djhtml-vscode It's archived and not working anymore so I'm trying to fix it
So I pass the content of the document as stdin:
const process = spawn(environment.path, [
"-m",
DJHTML_MODULE,
"-",
]);
process.stdin.write(document.getText());
process.stdin.end()
But when listening on error, I need to check the error message to skip them, it's not really nice and robust. The stderr should only print error for me, and not info so I'd like to silence this message
process.stderr.on("data", (data: String) => {
if (data.includes(`No module named ${DJHTML_MODULE}`)) {
vscode.window.showErrorMessage(
`djhtml is not installed in the current Python environment`
);
} else {
if (!data.includes('templates have been reindented') && !data.includes('template has been reindented.')) {
vscode.window.showErrorMessage(
`djhtml failed with error: ${data}`
);
}
}
});
Just thought about this, but perhaps a --log-level option would be better
Finally I used the exit code, it's fine like this
Hello,
Would it be possible to have an option to don't print info ?
These 2 info are printed on stderr on each run, it's not really easy to detect if it's a real error message without parsing the output.
I saw there was a quiet mode that has been removed, but it seems it wasn't the same purpose. https://github.com/rtts/djhtml/commit/0cb953418b0c5e4d391e9a89bcca3b687834fda5
Is it possible to have a quiet mode which doesn't print the info but only the error ?
If you are okay to add this option, I can contribute, let me know.