Generate help from the same metadata

Version 0.9.1 Updated Sep 04, 2026

#[derive(OrthoConfig)] also implements OrthoConfigDocs. The metadata records fields, source names, precedence, discovery, defaults, and nested subcommands. Derive OrthoConfigSubcommandDocs on a clap::Subcommand enum so the generated tree includes every variant.

Inspect the metadata in code:

use ortho_config::{OrthoConfig, OrthoConfigDocs};
use serde::{Deserialize, Serialize};

#[derive(Deserialize, Serialize, OrthoConfig)]
#[ortho_config(prefix = "ACME_")]
struct Config {
    /// Address on which the service listens.
    #[ortho_config(default = String::from("127.0.0.1"))]
    host: String,
}

fn main() {
    let metadata = Config::get_doc_metadata();
    assert_eq!(metadata.fields.len(), 1);
    assert_eq!(metadata.fields[0].name, "host");
    println!("field={}", metadata.fields[0].name);
}

Or use cargo-orthohelp to emit intermediate representation (IR), Unix man pages, PowerShell help, compact agent context, or all formats:

cargo orthohelp --package hello_world --format agent-context

The tool builds a small bridge against the selected package. Keep the root configuration type public and ensure its documentation metadata is available from the selected library or binary target. --format all includes agent context as well as IR, man pages, and PowerShell output.