#![expect(
clippy::missing_errors_doc,
clippy::must_use_candidate,
clippy::module_name_repetitions,
reason = "public API is for integration tests, not external consumers"
)]
pub mod cli;
pub mod client;
pub mod commands;
pub mod config;
pub mod error;
pub(crate) mod http;
#[expect(clippy::print_stdout, clippy::expect_used)]
pub(crate) mod output;
pub mod types;
pub(crate) mod xmlrpc;
pub async fn dispatch(cli: &cli::Cli, format: types::OutputFormat) -> error::Result<()> {
let api = cli.api;
let server = cli.server.as_deref();
match &cli.command {
cli::Commands::Bug { action } => commands::bug::execute(action, server, format, api).await,
cli::Commands::Comment { action } => {
commands::comment::execute(action, server, format, api).await
}
cli::Commands::Attachment { action } => {
commands::attachment::execute(action, server, format, api).await
}
cli::Commands::Config { action } => {
commands::config::execute(action, server, format, api).await
}
cli::Commands::Product { action } => {
commands::product::execute(action, server, format, api).await
}
cli::Commands::Field { action } => {
commands::field::execute(action, server, format, api).await
}
cli::Commands::User { action } => {
commands::user::execute(action, server, format, api).await
}
cli::Commands::Group { action } => {
commands::group::execute(action, server, format, api).await
}
cli::Commands::Whoami { action } => {
let whoami_action = action.as_ref().unwrap_or(&cli::WhoamiAction::Show);
commands::whoami::execute(whoami_action, server, format, api).await
}
cli::Commands::Server { action } => {
commands::server::execute(action, server, format, api).await
}
cli::Commands::Classification { action } => {
commands::classification::execute(action, server, format, api).await
}
cli::Commands::Component { action } => {
commands::component::execute(action, server, format, api).await
}
cli::Commands::Template { action } => {
commands::template::execute(action, server, format, api).await
}
cli::Commands::Query { action } => {
commands::query::execute(action, server, format, api).await
}
}
}
#[cfg(any(test, feature = "test-helpers"))]
pub static ENV_LOCK: tokio::sync::Mutex<()> = tokio::sync::Mutex::const_new(());
#[cfg(any(test, feature = "test-helpers"))]
pub mod test_helpers;