From 5d62d897f42e52b6ad62b7c104b54aecf3fdd8e5 Mon Sep 17 00:00:00 2001 From: Jeff Date: Sun, 13 Oct 2024 08:04:32 -0400 Subject: [PATCH] Ads no-run command to the CLI --- dust-lang/src/formatter.rs | 15 --------------- dust-shell/src/main.rs | 5 ++++- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/dust-lang/src/formatter.rs b/dust-lang/src/formatter.rs index 5331eab..3df3ce3 100644 --- a/dust-lang/src/formatter.rs +++ b/dust-lang/src/formatter.rs @@ -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 } } diff --git a/dust-shell/src/main.rs b/dust-shell/src/main.rs index 8d3d139..2fcaf1b 100644 --- a/dust-shell/src/main.rs +++ b/dust-shell/src/main.rs @@ -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); } }