use clap::builder::Styles;
use clap::builder::styling::{AnsiColor, Effects};
use clap::{Arg, ArgAction, Command, crate_name, crate_version};
pub fn build_app() -> Command {
Command::new(crate_name!())
.version(crate_version!())
.about("Command line tool to analyze the WildFly management model.")
.styles(Styles::styled()
.header(AnsiColor::Green.on_default() | Effects::BOLD)
.usage(AnsiColor::Green.on_default() | Effects::BOLD)
.literal(AnsiColor::Blue.on_default() | Effects::BOLD)
.placeholder(AnsiColor::Cyan.on_default()))
.propagate_version(true)
.subcommand_required(true)
.arg(Arg::new("json")
.long("json")
.global(true)
.action(ArgAction::SetTrue)
.help("Output results as JSON (for machine consumption)"))
.subcommand(Command::new("analyze")
.about("Analyze the management model of a WildFly instance or feature pack and build a self-contained Neo4J model image with the results")
.arg(Arg::new("identifier")
.required(true)
.help("A WildFly version (e.g. 39, 26.1) or feature pack (e.g. ai, graphql)")))
.subcommand(Command::new("push")
.about("Push model images to the remote registry")
.arg(Arg::new("identifier")
.required(true)
.help("WildFly versions, feature packs, or a mix (e.g. 34,ai,graphql)"))
.arg(Arg::new("chunks")
.short('c')
.long("chunks")
.value_name("SIZE")
.help("Push in batches of SIZE images instead of all at once")))
.subcommand(Command::new("start")
.about("Start model containers")
.arg(Arg::new("identifier")
.required(true)
.help("WildFly versions, feature packs, or a mix (e.g. 34,ai,graphql)")))
.subcommand(Command::new("stop")
.about("Stop model containers")
.arg(Arg::new("identifier")
.required_unless_present("all")
.help("WildFly versions, feature packs, or a mix (e.g. 34,ai,graphql)"))
.arg(Arg::new("all")
.short('a')
.long("all")
.action(ArgAction::SetTrue)
.help("Stop all running Neo4J model DB containers")))
.subcommand(Command::new("versions")
.about("List all supported WildFly versions"))
.subcommand(Command::new("feature-packs")
.about("List all supported feature packs"))
.subcommand(Command::new("images")
.about("List all available model images")
.arg(Arg::new("wildfly")
.short('w')
.long("wildfly")
.action(ArgAction::SetTrue)
.help("Show only WildFly versions"))
.arg(Arg::new("feature-packs")
.short('f')
.long("feature-packs")
.action(ArgAction::SetTrue)
.help("Show only feature packs")))
.subcommand(Command::new("ps")
.about("List running model containers"))
.subcommand(Command::new("browse")
.about("Open the Neo4J browser for running model containers")
.arg(Arg::new("identifier")
.required(true)
.help("WildFly versions, feature packs, or a mix (e.g. 34,ai,graphql)")))
.subcommand(Command::new("update")
.about("Update WildFly and feature pack configuration files"))
.subcommand(Command::new("completions")
.about("Generate and install shell completions")
.arg(Arg::new("shell")
.help("The shell to generate completions for [default: auto-detected]"))
.arg(Arg::new("install")
.short('i')
.long("install")
.action(ArgAction::SetTrue)
.help("Install completions to the standard location for the shell")))
}