#![deny(missing_docs)]
#![deny(clippy::panic)]
#![warn(clippy::all, clippy::pedantic)]
mod commands;
mod output;
use clap::{Parser, Subcommand};
use std::process::ExitCode;
#[derive(Parser)]
#[command(name = "trueno-zram")]
#[command(author, version, about, long_about = None)]
struct Cli {
#[arg(long, default_value = "table")]
format: output::OutputFormat,
#[command(subcommand)]
command: Commands,
}
#[derive(Subcommand)]
enum Commands {
Create(commands::CreateArgs),
Remove(commands::RemoveArgs),
Status(commands::StatusArgs),
Benchmark(commands::BenchmarkArgs),
}
fn main() -> ExitCode {
let cli = Cli::parse();
let result = match &cli.command {
Commands::Create(args) => commands::create(args),
Commands::Remove(args) => commands::remove(args),
Commands::Status(args) => commands::status(args, cli.format),
Commands::Benchmark(args) => commands::benchmark(args),
};
match result {
Ok(()) => ExitCode::SUCCESS,
Err(e) => {
eprintln!("Error: {e}");
ExitCode::FAILURE
}
}
}