Skip to main content

haste_health/commands/
doc.rs

1use haste_fhir_operation_error::OperationOutcomeError;
2
3use crate::Cli;
4
5pub(crate) async fn generate_cli_markdown(output: &str) -> Result<(), OperationOutcomeError> {
6    let markdown: String = clap_markdown::help_markdown::<Cli>();
7
8    let top_string = "
9| Context | Invocation                     |
10| ------- | ------------------------------ |
11| Source  | `cargo run <command>`          |
12| Binary  | `./haste-health <command>`     |
13| Docker  | `docker run <image> <command>` |
14";
15
16    let markdown = format!("{top_string}\n\n{markdown}");
17
18    std::fs::write(output, markdown).map_err(|e| {
19        OperationOutcomeError::error(
20            haste_fhir_model::r4::generated::terminology::IssueType::exception(),
21            e.to_string(),
22        )
23    })?;
24
25    Ok(())
26}