From 8b70a1dcc472c9cc4583cc77088f2008bded8a54 Mon Sep 17 00:00:00 2001 From: Jeff Date: Fri, 18 Oct 2024 23:09:07 -0400 Subject: [PATCH] Clean up --- dust-shell/src/main.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/dust-shell/src/main.rs b/dust-shell/src/main.rs index 5b5bdcd..1628f1f 100644 --- a/dust-shell/src/main.rs +++ b/dust-shell/src/main.rs @@ -17,11 +17,11 @@ struct Cli { /// Whether to output line numbers in formatted source code #[arg(long)] - format_line_numbers: bool, + format_line_numbers: Option, /// Whether to output colors in formatted source code #[arg(long)] - format_colored: bool, + format_colored: Option, /// Whether to output the disassembled chunk #[arg(short, long)] @@ -29,7 +29,7 @@ struct Cli { /// Whether to style the disassembled chunk #[arg(long)] - style_disassembly: bool, + style_disassembly: Option, #[arg(short, long)] log: Option, @@ -77,11 +77,16 @@ fn main() { }; if args.format { - format_source(source, args.format_line_numbers, args.format_colored); + let line_numbers = args.format_line_numbers.unwrap_or(true); + let colored = args.format_colored.unwrap_or(true); + + format_source(source, line_numbers, colored); } if args.parse { - parse_source(source, args.style_disassembly); + let style = args.style_disassembly.unwrap_or(true); + + parse_source(source, style); } if args.format || args.parse {