#![allow(dead_code)]
mod commands;
use xacli::derive::{App, Command};
use xacli::Context;
#[derive(App)]
#[app(
name = "xacli",
version = "0.2.1",
title = "XaCLI",
description = "A modern, developer-friendly CLI framework tooling"
)]
struct XacliApp {
#[command(subcommands)]
commands: XacliCommands,
}
#[derive(Command)]
enum XacliCommands {
Doc(DocCmd),
Test(TestCmd),
}
#[derive(Command)]
#[command(description = "Documentation tooling commands")]
struct DocCmd {
#[command(subcommands)]
action: DocActions,
}
#[derive(Command)]
enum DocActions {
Build(DocBuildCmd),
}
#[derive(Command)]
#[command(
name = "build",
description = "Convert .xacli.hcl specification files to VHS tape format"
)]
struct DocBuildCmd {
#[arg(positional)]
directory: bool,
}
impl DocBuildCmd {
fn run(&self, ctx: &mut dyn Context) -> xacli::Result<()> {
commands::doc::build_command(ctx)
}
}
#[derive(Command)]
#[command(description = "Test report commands")]
struct TestCmd {
#[command(subcommands)]
action: TestActions,
}
#[derive(Command)]
enum TestActions {
Report(TestReportCmd),
}
#[derive(Command)]
#[command(
name = "report",
description = "Display test report from .xacli/reports/"
)]
struct TestReportCmd {
#[arg(long = "format", short = 'f')]
format: bool,
#[arg(long = "input", short = 'i')]
input: bool,
}
impl TestReportCmd {
fn run(&self, ctx: &mut dyn Context) -> xacli::Result<()> {
commands::test::report_command(ctx)
}
}
fn main() {
if let Err(e) = XacliApp::execute() {
eprintln!("Error: {}", e);
std::process::exit(2);
}
}