feat: add silent flag to all warning supression
This commit is contained in:
parent
97c382715f
commit
0b1297f3b7
|
@ -91,6 +91,7 @@ pub fn default_filter(evt: &Event) -> bool {
|
|||
pub fn with_project<A>(
|
||||
directory: Option<&Path>,
|
||||
deny: bool,
|
||||
silent: bool,
|
||||
json: bool,
|
||||
mut action: A,
|
||||
) -> miette::Result<()>
|
||||
|
@ -122,10 +123,12 @@ where
|
|||
let warning_count = warnings.len();
|
||||
|
||||
if !json {
|
||||
if !silent {
|
||||
for warning in &warnings {
|
||||
eprintln!();
|
||||
warning.report()
|
||||
}
|
||||
}
|
||||
|
||||
if let Err(errs) = build_result {
|
||||
for err in &errs {
|
||||
|
@ -156,7 +159,7 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
if warning_count > 0 && deny {
|
||||
if warning_count > 0 && deny && !silent {
|
||||
Err(ExitFailure::into_report())
|
||||
} else {
|
||||
Ok(())
|
||||
|
@ -249,7 +252,7 @@ where
|
|||
.if_supports_color(Stderr, |s| s.bold())
|
||||
.if_supports_color(Stderr, |s| s.purple()),
|
||||
);
|
||||
with_project(directory, false, false, &mut action).unwrap_or(())
|
||||
with_project(directory, false, false, false, &mut action).unwrap_or(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,6 +89,7 @@ pub fn exec(
|
|||
let result = with_project(
|
||||
directory.as_deref(),
|
||||
false,
|
||||
false,
|
||||
!io::stdout().is_terminal(),
|
||||
|p| {
|
||||
p.benchmark(
|
||||
|
|
|
@ -46,7 +46,7 @@ pub fn exec(
|
|||
mainnet,
|
||||
}: Args,
|
||||
) -> miette::Result<()> {
|
||||
with_project(directory.as_deref(), false, false, |p| {
|
||||
with_project(directory.as_deref(), false, false, false, |p| {
|
||||
let address = p.address(
|
||||
module.as_deref(),
|
||||
validator.as_deref(),
|
||||
|
|
|
@ -62,7 +62,7 @@ pub fn exec(
|
|||
validator,
|
||||
}: Args,
|
||||
) -> miette::Result<()> {
|
||||
with_project(None, false, false, |p| {
|
||||
with_project(None, false, false, false, |p| {
|
||||
eprintln!(
|
||||
"{} blueprint",
|
||||
" Analyzing"
|
||||
|
|
|
@ -36,7 +36,7 @@ pub fn exec(
|
|||
validator,
|
||||
}: Args,
|
||||
) -> miette::Result<()> {
|
||||
with_project(directory.as_deref(), false, false, |p| {
|
||||
with_project(directory.as_deref(), false, false, false, |p| {
|
||||
let address = p.address(
|
||||
module.as_deref(),
|
||||
validator.as_deref(),
|
||||
|
|
|
@ -36,7 +36,7 @@ pub fn exec(
|
|||
validator,
|
||||
}: Args,
|
||||
) -> miette::Result<()> {
|
||||
with_project(directory.as_deref(), false, false, |p| {
|
||||
with_project(directory.as_deref(), false, false, false, |p| {
|
||||
let policy = p.policy(
|
||||
module.as_deref(),
|
||||
validator.as_deref(),
|
||||
|
|
|
@ -13,6 +13,10 @@ pub struct Args {
|
|||
#[clap(short = 'D', long)]
|
||||
deny: bool,
|
||||
|
||||
/// Silence warnings; warnings will not be printed
|
||||
#[clap(short = 'S', long)]
|
||||
silent: bool,
|
||||
|
||||
/// When enabled, re-run the command on file changes instead of exiting
|
||||
#[clap(short, long)]
|
||||
watch: bool,
|
||||
|
@ -75,6 +79,7 @@ pub fn exec(
|
|||
Args {
|
||||
directory,
|
||||
deny,
|
||||
silent,
|
||||
watch,
|
||||
uplc,
|
||||
trace_filter,
|
||||
|
@ -96,7 +101,7 @@ pub fn exec(
|
|||
)
|
||||
})
|
||||
} else {
|
||||
with_project(directory.as_deref(), deny, false, |p| {
|
||||
with_project(directory.as_deref(), deny, silent, false, |p| {
|
||||
p.build(
|
||||
uplc,
|
||||
match trace_filter {
|
||||
|
|
|
@ -35,6 +35,10 @@ pub struct Args {
|
|||
#[clap(short = 'D', long)]
|
||||
deny: bool,
|
||||
|
||||
/// Silence warnings; warnings will not be printed
|
||||
#[clap(short = 'S', long)]
|
||||
silent: bool,
|
||||
|
||||
/// Skip tests; run only the type-checker
|
||||
#[clap(short, long)]
|
||||
skip_tests: bool,
|
||||
|
@ -108,6 +112,7 @@ pub fn exec(
|
|||
Args {
|
||||
directory,
|
||||
deny,
|
||||
silent,
|
||||
skip_tests,
|
||||
debug,
|
||||
show_json_schema,
|
||||
|
@ -150,6 +155,7 @@ pub fn exec(
|
|||
with_project(
|
||||
directory.as_deref(),
|
||||
deny,
|
||||
silent,
|
||||
!io::stdout().is_terminal(),
|
||||
|p| {
|
||||
p.check(
|
||||
|
|
|
@ -11,6 +11,10 @@ pub struct Args {
|
|||
#[clap(short = 'D', long)]
|
||||
deny: bool,
|
||||
|
||||
/// Silence warnings; warnings will not be printed
|
||||
#[clap(short = 'S', long)]
|
||||
silent: bool,
|
||||
|
||||
/// When enabled, re-run the command on file changes instead of exiting
|
||||
#[clap(short, long)]
|
||||
watch: bool,
|
||||
|
@ -28,6 +32,7 @@ pub fn exec(
|
|||
Args {
|
||||
directory,
|
||||
deny,
|
||||
silent,
|
||||
watch,
|
||||
destination,
|
||||
include_dependencies,
|
||||
|
@ -38,7 +43,7 @@ pub fn exec(
|
|||
p.docs(destination.clone(), include_dependencies)
|
||||
})
|
||||
} else {
|
||||
with_project(directory.as_deref(), deny, false, |p| {
|
||||
with_project(directory.as_deref(), deny, silent, false, |p| {
|
||||
p.docs(destination.clone(), include_dependencies)
|
||||
})
|
||||
};
|
||||
|
|
|
@ -61,7 +61,7 @@ pub fn exec(
|
|||
trace_level,
|
||||
}: Args,
|
||||
) -> miette::Result<()> {
|
||||
with_project(directory.as_deref(), false, false, |p| {
|
||||
with_project(directory.as_deref(), false, false, false, |p| {
|
||||
p.compile(Options::default())?;
|
||||
|
||||
let export = p.export(
|
||||
|
|
Loading…
Reference in New Issue