use clap::{Parser, Subcommand};
#[derive(Parser, Debug)]
#[command(name = "ulm")]
#[command(
author,
version,
about = "AI-powered manpage assistant using local LLM"
)]
#[command(
long_about = "ulm transforms CLI interaction from 'memorize commands' to 'describe intent'. \
It provides an AI-powered bridge between what you want to accomplish and the \
thousands of powerful but cryptic Unix tools available on your system."
)]
pub struct Args {
#[command(subcommand)]
pub command: Option<Commands>,
#[arg(trailing_var_arg = true)]
pub query: Vec<String>,
}
#[derive(Subcommand, Debug, Clone)]
pub enum Commands {
Setup,
Update,
Clean,
}
impl Args {
#[must_use]
pub fn parse_args() -> Self {
Self::parse()
}
#[must_use]
pub fn has_query(&self) -> bool {
!self.query.is_empty()
}
#[must_use]
pub fn query_string(&self) -> String {
self.query.join(" ")
}
}