Add without tiles option ❤
This commit is contained in:
parent
a3eb3115bc
commit
6be7873702
3 changed files with 22 additions and 7 deletions
11
Cargo.toml
11
Cargo.toml
|
@ -7,7 +7,16 @@ license = "MIT"
|
||||||
description = "Brainfu*k interpreter and REPL written in Rust"
|
description = "Brainfu*k interpreter and REPL written in Rust"
|
||||||
repository = "https://github.com/anas-elgarhy/bf-interpreter"
|
repository = "https://github.com/anas-elgarhy/bf-interpreter"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
keywords = ["brainfuck", "interpreter", "repl"]
|
keywords = [
|
||||||
|
"brainfuck",
|
||||||
|
"interpreter",
|
||||||
|
"repl",
|
||||||
|
"bf",
|
||||||
|
"bf-interpreter",
|
||||||
|
"bf-repl",
|
||||||
|
"brainfuck-interpreter",
|
||||||
|
"brainfuck-repl",
|
||||||
|
]
|
||||||
categories = ["command-line-utilities"]
|
categories = ["command-line-utilities"]
|
||||||
documentation = "https://docs.rs/bf-interpreter"
|
documentation = "https://docs.rs/bf-interpreter"
|
||||||
homepage = "https://github.com/anas-elgarhy/bf-interpreter"
|
homepage = "https://github.com/anas-elgarhy/bf-interpreter"
|
||||||
|
|
|
@ -11,6 +11,9 @@ pub struct Args {
|
||||||
/// The brainfuck array size
|
/// The brainfuck array size
|
||||||
#[arg(short, long, default_value = "30000")]
|
#[arg(short, long, default_value = "30000")]
|
||||||
pub array_size: usize,
|
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)]
|
#[derive(Debug, PartialEq, Copy, Clone, ValueEnum)]
|
||||||
|
|
15
src/main.rs
15
src/main.rs
|
@ -30,12 +30,15 @@ fn main() {
|
||||||
info!("Running brainfuck source code from file: {}", source);
|
info!("Running brainfuck source code from file: {}", source);
|
||||||
match interpreter.run(None) {
|
match interpreter.run(None) {
|
||||||
Ok(exit_code) => {
|
Ok(exit_code) => {
|
||||||
println!(
|
info!("Finished running brainfuck source code from file: {}", source);
|
||||||
"Successfully ran brainfuck source code from file: {}",
|
if !args.without_tiles {
|
||||||
source
|
println!(
|
||||||
);
|
"Successfully ran brainfuck source code from file: {}",
|
||||||
println!("Exiting with code: {exit_code}");
|
source
|
||||||
std::process::exit(0);
|
);
|
||||||
|
println!("Exiting with code: {exit_code}");
|
||||||
|
std::process::exit(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
error!("Failed to run brainfuck source code from file: {}", e);
|
error!("Failed to run brainfuck source code from file: {}", e);
|
||||||
|
|
Loading…
Reference in a new issue