xbp 0.7.0

XBP is a build pack and deployment management tool to deploy, rust, nextjs etc and manage the NGINX configs below it
Documentation
//! custom help renderer
//!
//! provides stylized help banner and custom guidance
//! detects xbp projects and shows service specific commands
//! displays available services when in an xbp project directory

use tracing::info;
use crate::commands::service::{is_xbp_project, load_xbp_config};
use crate::strategies::get_all_services;

/// Print a stylized help banner and quick usage guide.
pub async fn print_help() {
    info!(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::");
    info!(":.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.::.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.::.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:");
    info!("::::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:.::::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:.::::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:.");
    info!(":.:::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:::.::::::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:::.::::::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:::::");
    info!("::.:::.:::::.:::.:::.:::.:::.:::.::::::.:::.:::.:::.:::.:.:.::.:::.:::.:::.:::.:::.:::.:::.:::.:::.::.:::.:::.:::.:::.:::.:::.:::.:::.:.::::.:::.:::.:::.::::");
    info!("::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:.:.:::::.:::::.:::.:::.:::.::####::.::.:::.:::.:*###=:.:::.::::::::::.:::.:::.:::.:::.:::.:::.:.::::.:::.:::.:::.::::");
    info!("::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:.:.::::.:::.:::::=%%##-:.::.:::.:::#%%%+:::.:::.:.:.:.:::.:::.:::.:::.:::.:::.:::.:.::::.:::.:::.:::.::::");
    info!("::.:::.:.:::.:::.:::.:::.:::.:::::.:::.:::.:::.:.:.:.:.:.:::.:.:::=%%%#::.::.:::.:*%#%+:.:::.::::::::::::.:::.:::.:::.:::.:::.:::.:::.:.::::.:::.:::.:::.::::");
    info!("::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:.:.::::::.:::::.:.:=#%#%-:.::.:::#%#%+:::.:::.:.:.:.:.:::.:::.:::.:::.:::.:::.:::.:.::::.:::.:::.:::.::::");
    info!("::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:.:.::.:.::.:.:.:::::=%%#%::.::.:#%%%+:.:.:.:::::::.::::::.:::.:::.:::.:::.:::.:::.:.::::.:::.:::.:::.::::");
    info!("::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:.:.:::::.::::::.:.:.:=%%#%=:.:-#%#%+:::::::.:.:.:.:.:.:::.:::.:::.:::.:::.:::.:::.:.::::.:::.:::.:::.::::");
    info!("::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:.:.:.:.::.:.:.:::::::=#%%#=::.-#%%#+:.:.:.:::::::::::::::.:::.:::.:::.:::.:::.:::.:.::::.:::.:::.:::.::::");
    info!("::.:::.:::.:.::.::.:.:.:.::::::.::.:::.:.:.:.:.::..::::.::::::.:.:.:=%%##-:.::::#%%%+:::.:.:.:.:.:.:.::::.:::.:::.:::.:::.:::.:::.:.::::.:::.:::.:::.::::");
    info!("::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:.:.:::.:.:.::::::=##%%-:::.:.::##%%+:.:::::::.:::.:.:::.:::.:::.:::.:::.:::.:::.:.::::.:::.:::.:::.::::");
    info!("::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:.:.::.:::::::.:.::=%%%#::.::::::::##%#+::.:.:.::.::::::::.:::.:::.:::.:::.:::.:::.:.::::.:::.:::.:::.::::");
    info!("::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:.:.:::.:.:.:.:::.=#%##-:::.:.:.:.::#%%%*::::.:.::.:.:.:::.:::.:::.:::.:::.:::.:::.:.::::.:::.:::.:::.::::");
    info!("::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:.:.::::::::.:::%%##::.:.::::::::::*#%#-.:.:::.:::::::::.:::.:::.:::.:::.:::.:::.:.::::.:::.:::.:::.::::");
    info!("::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:.:.::.:.:.:.::.::.::::::::.:.:.:.:.:::.:::::.:::.:.:.::::.:::.:::.:::.:::.:::.:::.:.::::.:::.:::.:::.::::");
    info!("::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:.:.:::::::.:.::.::.:.:.:.::::::.:::.:::.:.:.:.:::::::.:::.:::.:::.:::.:::.:::.:::.:.::::.:::.:::.:::.::::");
    info!("::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:::.:.:.:::::::.:.::.::.:.:.:.::::::.::.:::.:.:.:.:::::::.:::.:::.:::.:::.:::.:::.:::.:.::::.:::.:::.:::.::::");
    info!("");
    info!("📋 Usage: xbp <command> [options]");
    info!("");
    info!("🚀 Commands:");
    info!("  🔌 ports     [-p <port>] [--debug] [--kill] [-n]    List active ports and processes, optionally search NGINX configs");
    info!("  ⚙️  setup                                      Run initial setup commands");
    info!("  🔄 redeploy   [<service-name>]                 Redeploy (legacy redeploy.sh or specific service)");
    info!("  📡 redeploy_v2 [-p <password>] [-u <username>] [-h <host>] [-d <project_dir>]    Remotely redeploy using redeploy.sh");
    info!("  📝 config                                     Display xbp.json contents");
    info!("  📦 install    <package>                       Install a package");
    info!("  📋 logs                                        View XBP logs");
    
    if is_xbp_project().await {
        info!("");
        info!("🔧 Service Commands:");
        info!("  📋 services                                List all services");
        info!("  ⚙️  service   <command> <service-name>      Run command for a service");
        info!("     Commands: build, install, start, dev");
        info!("     Example: xbp service build zeus");
        
        if let Ok(config) = load_xbp_config().await {
            let services = get_all_services(&config);
            if !services.is_empty() {
                info!("");
                info!("📦 Available Services:");
                for service in services.iter().take(5) {
                    info!("  • {} ({}:{})", service.name, service.target, service.port);
                }
                if services.len() > 5 {
                    info!("  ... and {} more", services.len() - 5);
                }
            }
        }
    }
    
    info!("");
    info!("💡 Examples:");
    info!("  xbp ports -p 3000 --kill    # Kill processes on port 3000");
    info!("  xbp setup --debug           # Run setup with debug output");
    info!("  xbp install docker          # Install Docker package");
    info!("  xbp logs -c install         # View install command logs");
    if is_xbp_project().await {
        info!("  xbp services                  # List all services");
        info!("  xbp service build zeus         # Build zeus service");
        info!("  xbp redeploy zeus              # Redeploy zeus service");
    }
    info!("  xbp -v                      # Display XBP version");
    info!("");
}