#![warn(clippy::all)]
#![warn(clippy::pedantic)]
use std::process;
use clap::{Parser, Subcommand};
use breakmancer::{breakpoint, controller, util};
#[derive(Debug, Parser)]
#[command(name = "breakmancer")]
#[command(about = "Drop a breakpoint into any shell.")]
#[command(version, arg_required_else_help = true)]
struct Cli {
#[command(subcommand)]
command: Commands,
}
#[derive(Subcommand, Debug)]
enum Commands {
#[command(name = "start")]
Controller(controller::Cli),
#[command(name = "break")]
Break(breakpoint::Cli),
}
#[tokio::main]
async fn main() {
util::configure_logging();
let args = Cli::parse();
let outcome = match args.command {
Commands::Controller(args) => Box::pin(controller::run(&args)).await,
Commands::Break(args) => Box::pin(breakpoint::run(&args)).await,
};
if let Err(err) = outcome {
eprintln!("{err}");
process::exit(1)
}
}