hive-forge: add markdown-docs generator and CI freshness check
This commit is contained in:
parent
e2bf72631a
commit
d27cf6ce3e
8 changed files with 1453 additions and 1 deletions
|
|
@ -11,6 +11,7 @@ path = "src/main.rs"
|
|||
[dependencies]
|
||||
anyhow = { workspace = true }
|
||||
clap = { workspace = true }
|
||||
clap-markdown = "0.1"
|
||||
# `sync` = blocking client (hive-forge is a blocking CLI). TLS backend comes
|
||||
# from feature unification on reqwest — which only works because forgejo-api
|
||||
# and this crate now resolve to the SAME reqwest version; cargo unifies
|
||||
|
|
|
|||
|
|
@ -195,6 +195,13 @@ enum Verb {
|
|||
/// remote URL.
|
||||
#[command(hide = true)]
|
||||
CredentialHelper(verbs::credential_helper::Args),
|
||||
/// Emit the full CLI reference as Markdown, walking hive-forge's own
|
||||
/// clap command tree.
|
||||
///
|
||||
/// Hidden tooling command used by the docs build to keep the published
|
||||
/// `hive-forge` reference in lockstep with the code.
|
||||
#[command(hide = true)]
|
||||
MarkdownDocs,
|
||||
}
|
||||
|
||||
/// Wrapper over [`run`] that owns how a failure reaches the operator.
|
||||
|
|
@ -245,6 +252,13 @@ fn run() -> Result<()> {
|
|||
if let Verb::CredentialHelper(args) = verb {
|
||||
return verbs::credential_helper::run(args, cli.forge.as_deref());
|
||||
}
|
||||
// Same reasoning as `credential-helper` above: no repo, no forge
|
||||
// credentials — just a pure render of the clap tree the docs build
|
||||
// pipes into `docs/tools/forge-cli.md`.
|
||||
if let Verb::MarkdownDocs = verb {
|
||||
print!("{}", clap_markdown::help_markdown::<Cli>());
|
||||
return Ok(());
|
||||
}
|
||||
let client = client::Client::from_env(cli.repo, cli.json, cli.forge)
|
||||
.context("initialize forge client")?;
|
||||
// Attach the resolved repo to every verb's error uniformly here,
|
||||
|
|
@ -330,7 +344,7 @@ fn dispatch(client: &client::Client, verb: Verb) -> Result<()> {
|
|||
Verb::CiLog(a) => verbs::ci_log::run(client, a),
|
||||
Verb::CiRerun(a) => verbs::ci_rerun::run(client, a),
|
||||
Verb::CiRuns(a) => verbs::ci_runs::run(client, a),
|
||||
Verb::CredentialHelper(_) => {
|
||||
Verb::CredentialHelper(_) | Verb::MarkdownDocs => {
|
||||
unreachable!("handled in `run` before client construction")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue