use std::path::PathBuf;
use anyhow::Result;
use clap::Parser;
#[derive(Parser)]
#[command(name = "launch", about = "Discover services in a repository")]
struct Cli {
#[arg(default_value = ".")]
path: PathBuf,
#[arg(long, default_value = "json-pretty", value_parser = ["json", "json-pretty"])]
format: String,
}
fn main() -> Result<()> {
let cli = Cli::parse();
let discovery = launch::discover_local(&cli.path)?;
let output = match cli.format.as_str() {
"json" => serde_json::to_string(&discovery)?,
_ => serde_json::to_string_pretty(&discovery)?,
};
println!("{output}");
Ok(())
}