2022-02-11 04:38:04 -06:00
|
|
|
use std::path::PathBuf;
|
|
|
|
use clap::{ Parser, Subcommand };
|
|
|
|
|
|
|
|
const VERSION: &str = env!("CARGO_PKG_VERSION");
|
|
|
|
|
2022-03-25 00:51:37 -05:00
|
|
|
/// Hazure compiler
|
2022-02-11 04:38:04 -06:00
|
|
|
#[derive(Parser, Debug)]
|
|
|
|
#[clap(
|
|
|
|
version = VERSION,
|
|
|
|
long_about = None)]
|
|
|
|
pub struct Args {
|
|
|
|
#[clap(subcommand)]
|
|
|
|
pub options: Options,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Subcommand, Debug)]
|
|
|
|
pub enum Options {
|
2022-02-11 05:16:13 -06:00
|
|
|
#[clap(about = "Compile an input file.")]
|
2022-02-11 04:38:04 -06:00
|
|
|
Compile {
|
2022-03-25 00:51:37 -05:00
|
|
|
/// The input file to compile
|
2022-02-11 04:38:04 -06:00
|
|
|
#[clap(parse(from_os_str))]
|
|
|
|
input: PathBuf,
|
2022-03-25 00:51:37 -05:00
|
|
|
/// Print parsed AST and exit (for debugging)
|
2022-02-11 04:38:04 -06:00
|
|
|
#[clap(short, long)]
|
|
|
|
ast: bool,
|
2022-03-25 00:51:37 -05:00
|
|
|
/// Log process
|
2022-03-07 03:48:36 -06:00
|
|
|
#[clap(short, long)]
|
|
|
|
log: bool,
|
2022-03-25 00:51:37 -05:00
|
|
|
/// Output file path
|
2022-03-07 03:48:36 -06:00
|
|
|
#[clap(short, long, parse(from_os_str))]
|
|
|
|
output: Option<PathBuf>,
|
2022-02-11 04:38:04 -06:00
|
|
|
},
|
2022-03-25 00:51:37 -05:00
|
|
|
}
|