bfy/src/arguments.rs

29 lines
1.2 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-08 07:35:40 +00:00
/// Dont print the tiles (e.g. exit code, file name, etc)
#[arg(short, long)]
pub without_tiles: bool,
2022-10-07 19:54:49 +00:00
}
#[derive(Debug, PartialEq, Copy, Clone, ValueEnum)]
pub enum Feature {
2022-10-10 20:55:50 +00:00
/// If the value is you want decrement the value and the value is 0, don't set the value to 255, otherwise decrement the value.
/// If the value is you want increment the value and the value is 255, don't set the value to 0, otherwise increment the value.
NoReverseValue,
2022-10-07 19:54:49 +00:00
/// 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-10 20:55:50 +00:00
AllowUtf8,
2022-10-07 23:06:35 +00:00
}