use clap::Parser;
use main_error::MainResult;
use nextcloud_route_extractor::{app_routes, core_routes};
use serde_json::to_writer_pretty;
use std::io::stdout;
#[derive(Parser)]
struct Args {
path: String,
#[arg(long)]
core: bool,
}
fn main() -> MainResult {
let args = Args::parse();
let routes = if args.core {
core_routes(&args.path)
} else {
app_routes(&args.path)
}?;
to_writer_pretty(stdout().lock(), &routes)?;
Ok(())
}