mod common;
mod error;
mod format;
mod indent;
mod repl;
mod repl_cmd;
mod xpath;
mod xslt;
use clap::{Parser, Subcommand};
pub(crate) const VERSION: &str = concat!(env!("CARGO_PKG_VERSION"), " ", env!("GIT_COMMIT"));
#[derive(Parser)]
#[command(author, about, version=VERSION, long_about)]
pub(crate) struct Cli {
#[command(subcommand)]
command: Commands,
}
#[derive(Subcommand)]
enum Commands {
Format(format::Format),
Indent(indent::Indent),
Xpath(xpath::XPath),
Repl(repl::Repl),
Xslt(xslt::Xslt),
}
fn main() -> anyhow::Result<()> {
let cli = Cli::parse();
match cli.command {
Commands::Indent(indent) => {
indent.run()?;
}
Commands::Format(format) => {
format.run()?;
}
Commands::Xpath(xpath) => {
xpath.run()?;
}
Commands::Repl(repl) => {
repl.run()?;
}
Commands::Xslt(xslt) => {
xslt.run()?;
}
}
Ok(())
}