nextcloud-route-extractor 0.1.3

Extract routes from nextcloud apps
Documentation
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 of the app to get routes from
    path: String,
    /// Extract apps from the server core instead of app
    #[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(())
}