Skip to main content

haste_health/commands/
mod.rs

1pub(crate) mod admin;
2pub(crate) mod api;
3pub(crate) mod codegen;
4pub(crate) mod config;
5pub(crate) mod doc;
6pub(crate) mod fhirpath;
7pub(crate) mod hl7v2;
8pub(crate) mod login;
9pub(crate) mod server;
10pub(crate) mod testscript;
11pub(crate) mod worker;
12
13use crate::{CliCommand, cli::state::CliState};
14use haste_fhir_operation_error::OperationOutcomeError;
15use std::sync::Arc;
16use tokio::sync::Mutex;
17
18pub(crate) async fn run(
19    state: Arc<Mutex<CliState>>,
20    command: &CliCommand,
21) -> Result<(), OperationOutcomeError> {
22    match command {
23        CliCommand::Doc { output } => doc::run(output).await,
24        CliCommand::FHIRPath { fhirpath } => fhirpath::run(fhirpath).await,
25        CliCommand::Generate { command } => codegen::run(command).await,
26        CliCommand::Server { command } => server::run(command).await,
27        CliCommand::Worker { command } => worker::run(command).await,
28        CliCommand::Config { command } => config::run(state, command).await,
29        CliCommand::Login => login::run(state).await,
30        CliCommand::Api { command } => api::run(state, command).await,
31        CliCommand::Testscript { command } => testscript::run(state, command).await,
32        CliCommand::Admin { command } => admin::run(command).await,
33        CliCommand::Hl7v2 { command } => hl7v2::run(state, command).await,
34    }
35}