52 lines
1.3 KiB
Rust
52 lines
1.3 KiB
Rust
use std::path::PathBuf;
|
|
|
|
use argh::FromArgs;
|
|
|
|
#[derive(FromArgs, PartialEq, Debug)]
|
|
#[argh(description = "reid compiler and Virtual Machine")]
|
|
pub struct MainOpt {
|
|
#[cfg(feature = "compiler")]
|
|
#[argh(positional, description = "run compiled .reidc from <path>")]
|
|
pub run_path: Option<PathBuf>,
|
|
|
|
#[cfg(not(feature = "compiler"))]
|
|
#[argh(positional, description = "run compiled .reidc from <path>")]
|
|
pub run_path: PathBuf,
|
|
|
|
#[argh(subcommand)]
|
|
#[cfg(feature = "compiler")]
|
|
pub subcommand: Option<Subcommand>,
|
|
}
|
|
|
|
#[cfg(feature = "compiler")]
|
|
#[derive(FromArgs, PartialEq, Debug)]
|
|
#[argh(subcommand)]
|
|
pub enum Subcommand {
|
|
Compile(Compile),
|
|
Run(Run),
|
|
}
|
|
|
|
#[derive(FromArgs, PartialEq, Debug)]
|
|
#[argh(
|
|
subcommand,
|
|
name = "compile",
|
|
description = "compile <source> to .reidc to <output> path"
|
|
)]
|
|
pub struct Compile {
|
|
#[argh(positional, description = "source .reid path")]
|
|
pub source: String,
|
|
#[argh(positional, description = "output .reidc path")]
|
|
pub output: Option<String>,
|
|
}
|
|
|
|
#[derive(FromArgs, PartialEq, Debug)]
|
|
#[argh(
|
|
subcommand,
|
|
name = "run",
|
|
description = "compile and run given .reid file"
|
|
)]
|
|
pub struct Run {
|
|
#[argh(positional, description = "source .reid path")]
|
|
pub source: PathBuf,
|
|
}
|