//! `toolport` - a small companion CLI for Toolport, the local MCP gateway.
//!
//! Toolport itself is a desktop app; this crate is a lightweight pointer so that
//! `cargo install toolport` surfaces what Toolport is and where to get it.

const HOMEPAGE: &str = "https://toolport.app";

const ABOUT: &str = "\
Toolport is a local gateway for your MCP servers: a single connection point for
every AI client (Claude, Cursor, VS Code, and more), with lazy tool discovery
that keeps the standing tool-context cost roughly 99% smaller than loading every
tool on every request.";

fn print_help() {
    println!("toolport {}", env!("CARGO_PKG_VERSION"));
    println!();
    println!("{ABOUT}");
    println!();
    println!("Usage:");
    println!("  toolport [--version | -V]   Print the version");
    println!("  toolport [--help | -h]      Print this help");
    println!();
    println!("Download the app and read the docs at {HOMEPAGE}");
}

fn main() {
    match std::env::args().nth(1).as_deref() {
        None | Some("-h") | Some("--help") => print_help(),
        Some("-V") | Some("--version") => println!("toolport {}", env!("CARGO_PKG_VERSION")),
        Some(other) => {
            eprintln!("toolport: unrecognized argument '{other}'");
            eprintln!("Run 'toolport --help', or visit {HOMEPAGE}");
            std::process::exit(2);
        }
    }
}
