pub mod daemon_ctl;
pub mod embedded_specs;
pub mod paths;
pub mod setup;
use clap::{Parser, Subcommand};
#[derive(Parser)]
#[command(name = "nh", about = "nighthawk — AI terminal autocomplete")]
struct Cli {
#[command(subcommand)]
command: Commands,
}
#[derive(Subcommand)]
enum Commands {
Start,
Stop,
Status,
Setup {
shell: String,
},
Complete {
input: String,
},
}
pub fn run() {
let cli = Cli::parse();
let result = match cli.command {
Commands::Start => daemon_ctl::start(),
Commands::Stop => daemon_ctl::stop(),
Commands::Status => daemon_ctl::status(),
Commands::Setup { shell } => setup::setup_shell(&shell),
Commands::Complete { input } => daemon_ctl::complete(&input),
};
if let Err(e) = result {
eprintln!("Error: {e}");
std::process::exit(1);
}
}