aboutsummaryrefslogtreecommitdiff
path: root/mling
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-06-07 17:11:12 +0800
committer魏曹先生 <1992414357@qq.com>2026-06-07 17:11:12 +0800
commit50b34e06ad186a7fffff3a8c49b3f198118c87ce (patch)
tree8977caac5989bbc82db18f60e6dfa4745edcb463 /mling
parentdccb859175c32cea9aded9b7e54354f37f282368 (diff)
Respect `--no-error` and `--quiet` flags when resolving manifest path
Diffstat (limited to 'mling')
-rw-r--r--mling/src/cli.rs15
1 files changed, 13 insertions, 2 deletions
diff --git a/mling/src/cli.rs b/mling/src/cli.rs
index 21f7220..6a4c7d8 100644
--- a/mling/src/cli.rs
+++ b/mling/src/cli.rs
@@ -116,6 +116,13 @@ fn standard_output_setup(program: &mut Program<ThisProgram>) {
}
fn resolve_manifest_path(provided: Option<String>) -> PathBuf {
+ let p = ThisProgram::this();
+ let disable_error_output =
+ // --no-error
+ !p.stdout_setting.error_output ||
+ // or --quiet/--silence
+ p.stdout_setting.quiet;
+
if let Some(path) = provided {
let p = PathBuf::from_str(&path).unwrap();
if p.is_dir() {
@@ -123,7 +130,9 @@ fn resolve_manifest_path(provided: Option<String>) -> PathBuf {
if candidate.exists() {
return candidate;
}
- eprintln_cargo!("`{}` is not a crate root", p.display());
+ if !disable_error_output {
+ eprintln_cargo!("`{}` is not a crate root", p.display());
+ }
exit(1);
}
return p;
@@ -137,7 +146,9 @@ fn resolve_manifest_path(provided: Option<String>) -> PathBuf {
}
if !dir.pop() {
// Reached filesystem root without finding Cargo.toml
- eprintln_cargo!("`{}` is not a crate root", current_dir().unwrap().display());
+ if !disable_error_output {
+ eprintln_cargo!("`{}` is not a crate root", current_dir().unwrap().display());
+ }
exit(1);
}
}