30 lines
573 B
Rust
30 lines
573 B
Rust
|
//! 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,
|
||
|
}
|