use clap::Parser;
use std::error::Error;
use tofu::Config;
#[derive(Parser, Debug)]
#[command(version, about = "The Tofu LLM client")]
struct Args {
#[arg(short, long)]
verbose: bool,
message: Option<String>,
#[arg(short, long, alias = "configure", alias = "settings")]
config: bool,
#[arg(short, long, alias = "api-keys")]
keys: bool,
#[arg(short, long)]
profile: Option<String>,
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
let args = Args::parse();
if args.config {
tofu::open_config()?;
return Ok(());
}
if args.keys {
tofu::open_keys()?;
return Ok(());
}
let selected_profile = args.profile;
let message = args.message;
let config_file = tofu::load_config(selected_profile.as_deref())?;
let config = Config {
verbose: args.verbose,
interactive: message.is_none(),
message,
stream: config_file.stream,
file: Some(config_file),
};
tofu::run(config).await
}