mod commands;
mod errors;
mod output;
use clap::{Parser, Subcommand};
use std::process;
#[derive(Parser)]
#[command(name = "quillmark")]
#[command(about = "Command-line interface for Quillmark", long_about = None)]
#[command(version)]
struct Cli {
#[command(subcommand)]
command: Commands,
}
#[derive(Subcommand)]
enum Commands {
Render(commands::render::RenderArgs),
Schema(commands::schema::SchemaArgs),
Validate(commands::validate::ValidateArgs),
Info(commands::info::InfoArgs),
}
fn main() {
let cli = Cli::parse();
let result = match cli.command {
Commands::Render(args) => commands::render::execute(args),
Commands::Schema(args) => commands::schema::execute(args),
Commands::Validate(args) => commands::validate::execute(args),
Commands::Info(args) => commands::info::execute(args),
};
if let Err(e) = result {
errors::print_cli_error(&e);
process::exit(1);
}
}