From 6be7873702a53b479d2f8fc67d2496709eb7bee3 Mon Sep 17 00:00:00 2001 From: Anas Elgarhy Date: Sat, 8 Oct 2022 09:35:40 +0200 Subject: [PATCH] =?UTF-8?q?Add=20without=20tiles=20option=20=E2=9D=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.toml | 11 ++++++++++- src/arguments.rs | 3 +++ src/main.rs | 15 +++++++++------ 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index bba9ad0..5c7d1a5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,16 @@ license = "MIT" description = "Brainfu*k interpreter and REPL written in Rust" repository = "https://github.com/anas-elgarhy/bf-interpreter" readme = "README.md" -keywords = ["brainfuck", "interpreter", "repl"] +keywords = [ + "brainfuck", + "interpreter", + "repl", + "bf", + "bf-interpreter", + "bf-repl", + "brainfuck-interpreter", + "brainfuck-repl", +] categories = ["command-line-utilities"] documentation = "https://docs.rs/bf-interpreter" homepage = "https://github.com/anas-elgarhy/bf-interpreter" diff --git a/src/arguments.rs b/src/arguments.rs index ac75228..e72e125 100644 --- a/src/arguments.rs +++ b/src/arguments.rs @@ -11,6 +11,9 @@ pub struct Args { /// The brainfuck array size #[arg(short, long, default_value = "30000")] pub array_size: usize, + /// Dont print the tiles (e.g. exit code, file name, etc) + #[arg(short, long)] + pub without_tiles: bool, } #[derive(Debug, PartialEq, Copy, Clone, ValueEnum)] diff --git a/src/main.rs b/src/main.rs index 485a04d..75cc030 100644 --- a/src/main.rs +++ b/src/main.rs @@ -30,12 +30,15 @@ fn main() { info!("Running brainfuck source code from file: {}", source); match interpreter.run(None) { Ok(exit_code) => { - println!( - "Successfully ran brainfuck source code from file: {}", - source - ); - println!("Exiting with code: {exit_code}"); - std::process::exit(0); + info!("Finished running brainfuck source code from file: {}", source); + if !args.without_tiles { + println!( + "Successfully ran brainfuck source code from file: {}", + source + ); + println!("Exiting with code: {exit_code}"); + std::process::exit(0); + } } Err(e) => { error!("Failed to run brainfuck source code from file: {}", e);