1
0

Ads no-run command to the CLI

This commit is contained in:
Jeff 2024-10-13 08:04:32 -04:00
parent 565d3c54f1
commit 5d62d897f4
2 changed files with 4 additions and 16 deletions

View File

@ -86,21 +86,6 @@ impl<'src> Formatter<'src> {
}
}
let renderer = Renderer::styled();
let mut snippet = Snippet::source(&formatted).fold(false);
if let Some(origin) = self.origin {
snippet = snippet.origin(origin);
}
let mut message = Level::Info.title("Formatted source").snippet(snippet);
if let Some(footer) = self.footer {
message = message.footer(Level::Note.title("Footer").snippet(Snippet::source(footer)));
}
let formatted = renderer.info(Style::new()).render(message).to_string();
formatted
}
}

View File

@ -13,6 +13,9 @@ struct Cli {
#[arg(short, long)]
format: bool,
#[arg(short, long)]
no_run: bool,
#[arg(short, long)]
parse: bool,
@ -63,7 +66,7 @@ fn main() {
format_source(source);
}
if !args.format && !args.parse {
if !args.no_run {
run_source(source);
}
}