Initial Commit.

This commit is contained in:
Olivia Brooks
2026-01-25 21:20:03 -05:00
commit ef07526d57
15 changed files with 1561 additions and 0 deletions

59
src/cli.rs Normal file
View File

@@ -0,0 +1,59 @@
use std::sync::LazyLock;
use clap::{ArgAction, Parser, Subcommand};
pub static CONFIG: LazyLock<Args> = LazyLock::new(|| Args::parse());
#[derive(Debug, Parser)]
pub struct Args {
#[command(subcommand)]
pub command: Command,
}
#[derive(Debug, Subcommand)]
pub enum Command {
/// Create a new raven project
New { project_name: String },
/// Create a new raven project in an existing directory
Init,
/// Compile the current project
Build,
/// Run the current project
#[command(arg_required_else_help = true)]
Run {
#[arg(required = true)]
entry_point: String,
#[clap(flatten)]
assertions: Assertions,
},
/// Run the tests
Test {
#[clap(flatten)]
assertions: Assertions,
},
/// Remove the target directory
Clean,
}
impl Command {
pub fn depends_on_nest(&self) -> bool {
match self {
Self::Init | Self::New { .. } => false,
_ => true,
}
}
}
#[derive(Debug, clap::Args)]
pub struct Assertions {
/// Disable assertions.
#[arg(short, long = "no-assert", action = ArgAction::SetFalse)]
disable_assert: bool,
}
impl Into<bool> for &Assertions {
fn into(self) -> bool {
!self.disable_assert
}
}