crafting-interpreters/rust/rox/src/cli.rs

30 lines
573 B
Rust
Raw Normal View History

2025-02-06 10:34:46 +00:00
//! Cli interface.
use std::path::PathBuf;
use clap::{Args, Parser, Subcommand};
/// Interpreter for the Lox language.
#[derive(Parser)]
#[command(version, about, long_about = None)]
#[command(propagate_version = true)]
pub struct Cli {
#[command(subcommand)]
pub command: Commands,
}
#[derive(Args, Clone)]
pub struct CompileConfig {
/// Path to Lox source file.
#[arg(short, long)]
pub source: PathBuf,
}
#[derive(Subcommand)]
pub enum Commands {
/// Compile a Lox source file.
Compile(CompileConfig),
/// Run a Lox REPL.
Repl,
}