Ads no-run command to the CLI
This commit is contained in:
parent
565d3c54f1
commit
5d62d897f4
@ -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
|
formatted
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,9 @@ struct Cli {
|
|||||||
#[arg(short, long)]
|
#[arg(short, long)]
|
||||||
format: bool,
|
format: bool,
|
||||||
|
|
||||||
|
#[arg(short, long)]
|
||||||
|
no_run: bool,
|
||||||
|
|
||||||
#[arg(short, long)]
|
#[arg(short, long)]
|
||||||
parse: bool,
|
parse: bool,
|
||||||
|
|
||||||
@ -63,7 +66,7 @@ fn main() {
|
|||||||
format_source(source);
|
format_source(source);
|
||||||
}
|
}
|
||||||
|
|
||||||
if !args.format && !args.parse {
|
if !args.no_run {
|
||||||
run_source(source);
|
run_source(source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user