use clap::{Parser, Subcommand};
#[cfg(feature = "self-update")]
use crate::update;
use crate::{doctor, import, lsp, pantry, recipe, report, search, seed, server, shopping_list};
#[derive(Parser, Debug)]
#[command(
author,
version = concat!(env!("CARGO_PKG_VERSION"), " - in food we trust"),
about,
after_help = "Docs: https://cooklang.org/cli/"
)]
pub struct CliArgs {
#[arg(short = 'v', long = "verbose", action = clap::ArgAction::Count, global = true)]
pub verbosity: u8,
#[command(subcommand)]
pub command: Command,
}
#[derive(Debug, Subcommand)]
pub enum Command {
#[command(
alias = "r",
long_about = "Parse and display Cooklang recipe files with support for multiple output formats and scaling"
)]
Recipe(recipe::RecipeArgs),
#[command(
alias = "s",
long_about = "Run a web server to browse and interact with your recipe collection"
)]
Server(server::ServerArgs),
#[command(
visible_alias = "sl",
long_about = "Create shopping lists from one or more recipes with ingredient aggregation and categorization"
)]
ShoppingList(shopping_list::ShoppingListArgs),
#[command(long_about = "Populate a directory with example Cooklang recipes to get started")]
Seed(seed::SeedArgs),
#[command(
alias = "f",
long_about = "Search for recipes by ingredient, title, or any text content with relevance ranking"
)]
Search(search::SearchArgs),
#[command(
alias = "i",
long_about = "Import recipes from websites and automatically convert them to Cooklang format"
)]
Import(import::ImportArgs),
#[command(
alias = "rp",
long_about = "Generate custom reports and outputs from recipes using Jinja2 templates"
)]
Report(report::ReportArgs),
#[command(
long_about = "Check recipe collection for potential issues and suggest improvements"
)]
Doctor(doctor::DoctorArgs),
#[command(
alias = "p",
long_about = "Manage pantry inventory with full CRUD support and recipe-based analysis"
)]
Pantry(pantry::PantryArgs),
#[command(
long_about = "Start the Language Server Protocol server for Cooklang editor integration"
)]
Lsp(lsp::LspArgs),
#[cfg(feature = "self-update")]
#[command(
alias = "u",
long_about = "Check for and install updates to CookCLI from GitHub releases"
)]
#[cfg(feature = "self-update")]
Update(update::UpdateArgs),
}