mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-12-03 21:54:27 +01:00
MacosCommands and the argument structs of the subcommands that are not in Messages (start, stop, quickstart, permissions, pan, the animation commands and the 18 whose help still differs between the trees) move from komorebi-for-mac/komorebic/src/main.rs to komorebic-core::platform::macos with their fields made pub; the macOS main.rs keeps the handlers (1293 to about 600 lines). The definitions have no macOS-only dependency, so the pages of the macOS command line can now be written on any host: the docgen-all example of the crate does it, and replaces the harness that compiled the clap section of main.rs. clap_complete joins the crate for Completions. Verified: oracle (step4/oracle-check.sh, macOS pages now from the docgen-all example): macos 158 of 158 pages byte-identical (windows 187 and kde 166 still pass); macOS fake-CC cargo check --locked --workspace --all-targets: 0 errors; KDE cargo check -p komorebic: ok.
36 lines
1.3 KiB
Rust
36 lines
1.3 KiB
Rust
//! Write the pages of `docs/cli` of the platforms that live in this crate, on any host:
|
|
//! `cargo run -p komorebic-core --example docgen-all -- OUTDIR [windows|macos]...`
|
|
//! writes `OUTDIR/<platform>/<command>.md` for each platform named (all of them by default).
|
|
//! The pages are the ones `komorebic docgen` writes on that platform.
|
|
|
|
use komorebic_core::cli::Meta;
|
|
use komorebic_core::cli::command;
|
|
use komorebic_core::docgen::DocFormat;
|
|
use komorebic_core::docgen::write;
|
|
use std::path::PathBuf;
|
|
|
|
const META: Meta = Meta {
|
|
name: "komorebic",
|
|
about: "",
|
|
author: "",
|
|
version: "",
|
|
};
|
|
|
|
fn main() -> std::io::Result<()> {
|
|
let mut args = std::env::args().skip(1);
|
|
let out = PathBuf::from(args.next().expect("usage: docgen-all OUTDIR [platform]..."));
|
|
let mut platforms: Vec<String> = args.collect();
|
|
if platforms.is_empty() {
|
|
platforms = ["macos"].map(String::from).to_vec();
|
|
}
|
|
for platform in platforms {
|
|
let cli = match platform.as_str() {
|
|
"macos" => command::<komorebic_core::platform::macos::MacosCommands>(&META),
|
|
other => panic!("no platform {other} in this crate"),
|
|
};
|
|
let pages = write(cli, &DocFormat::PLAIN, &out.join(&platform))?;
|
|
println!("{platform}: {} pages", pages.len());
|
|
}
|
|
Ok(())
|
|
}
|