mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-18 06:38:38 +01:00
WindowsCommands and the argument structs of the subcommands that are not in Messages (start, stop, check, kill, the border, stackbar and custom-layout commands, the app-specific-configuration converters and the ones whose help still differs between the trees) move from komorebic/src/main.rs to komorebic-core::platform::windows with their fields pub; the Windows main.rs keeps the handlers (2164 to 1520 lines). Three fields named after a protocol type that a struct of the same name shadows (BorderStyle, BorderImplementation, StackbarMode) are written with their full path. docgen-all now writes the Windows pages too, so no harness is needed any more. Verified: oracle (step4/oracle-check.sh, Windows pages from the docgen-all example): windows 187 of 187 pages byte-identical, macos 158 of 158, kde 166 of 166; Windows cargo clippy --workspace --locked --all-targets -D warnings clean.
37 lines
1.4 KiB
Rust
37 lines
1.4 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 = ["windows", "macos"].map(String::from).to_vec();
|
|
}
|
|
for platform in platforms {
|
|
let cli = match platform.as_str() {
|
|
"macos" => command::<komorebic_core::platform::macos::MacosCommands>(&META),
|
|
"windows" => command::<komorebic_core::platform::windows::WindowsCommands>(&META),
|
|
other => panic!("no platform {other} in this crate"),
|
|
};
|
|
let pages = write(cli, &DocFormat::PLAIN, &out.join(&platform))?;
|
|
println!("{platform}: {} pages", pages.len());
|
|
}
|
|
Ok(())
|
|
}
|