bfy/src/arguments.rs

25 lines
1.1 KiB
Rust
Raw Normal View History

2022-10-07 19:54:49 +00:00
use clap::{arg, Parser, ValueEnum};
2022-10-07 18:17:21 +00:00
#[derive(Parser, Debug)]
#[command(author, about, long_about = None, version)]
pub struct Args {
/// The brainfuck source code file to run (if not will be entered in REPL mode)
2022-10-07 19:54:49 +00:00
#[arg(default_value = None)]
2022-10-07 18:17:21 +00:00
pub source: Option<String>,
2022-10-07 19:54:49 +00:00
#[arg(short, long, default_value = None)]
pub features: Option<Vec<Feature>>,
2022-10-07 18:17:21 +00:00
/// The brainfuck array size
#[arg(short, long, default_value = "30000")]
pub array_size: usize,
2022-10-07 19:54:49 +00:00
}
#[derive(Debug, PartialEq, Copy, Clone, ValueEnum)]
pub enum Feature {
/// If the value is you want decrement the value and the value is 0, set the value to 255, otherwise decrement the value.
/// If the value is you want increment the value and the value is 255, set the value to 0, otherwise increment the value.
ReverseCounter,
/// If the pointer at the end of the array, set the pointer to 0, otherwise increment the pointer.
/// If the pointer at the beginning of the array, set the pointer to the end of the array, otherwise decrement the pointer.
ReversePointer,
2022-10-07 23:06:35 +00:00
}