haste_health/commands/
mod.rs1pub(crate) mod admin;
2pub(crate) mod api;
3pub(crate) mod artifacts;
4pub(crate) mod codegen;
5pub(crate) mod doc;
6pub(crate) mod fhirpath;
7pub(crate) mod hl7v2;
8pub(crate) mod login;
9pub(crate) mod package;
10pub(crate) mod profile;
11pub(crate) mod server;
12pub(crate) mod subscription;
13pub(crate) mod testscript;
14pub(crate) mod worker;
15
16use crate::{CliCommand, cli::state::CliState};
17use haste_fhir_operation_error::OperationOutcomeError;
18use std::sync::Arc;
19use tokio::sync::Mutex;
20
21pub(crate) async fn run(
22 state: Arc<Mutex<CliState>>,
23 command: &CliCommand,
24) -> Result<(), OperationOutcomeError> {
25 match command {
26 CliCommand::Doc { output } => doc::run(output).await,
27 CliCommand::FHIRPath { fhirpath } => fhirpath::run(fhirpath).await,
28 CliCommand::Generate { command } => codegen::run(command).await,
29 CliCommand::Artifacts { command } => artifacts::run(command).await,
30 CliCommand::Subscription { command } => subscription::run(command).await,
31 CliCommand::Server { command } => server::run(command).await,
32 CliCommand::Worker { command } => worker::run(command).await,
33 CliCommand::Profile { command } => profile::run(state, command).await,
34 CliCommand::Login { no_browser } => login::run(state, *no_browser).await,
35 CliCommand::Api { command } => api::run(state, command).await,
36 CliCommand::Testscript { command } => testscript::run(state, command).await,
37 CliCommand::Admin { command } => admin::run(command).await,
38 CliCommand::Hl7v2 { command } => hl7v2::run(state, command).await,
39 CliCommand::Package { command } => package::run(state, command).await,
40 }
41}