#![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 credentials;
pub mod error;
pub(crate) mod field_aliases;
pub(crate) mod http;
#[expect(clippy::expect_used)]
pub mod output;
pub(crate) mod tls;
pub mod types;
pub mod url_parser;
pub mod validation;
pub mod xmlrpc;
pub async fn dispatch(
cli: &cli::Cli,
format: types::OutputFormat,
w: &mut output::writers::Writers<'_>,
) -> 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, w).await
}
cli::Commands::Comment { action } => {
commands::comment::execute(action, server, format, api, w).await
}
cli::Commands::Attachment { action } => {
commands::attachment::execute(action, server, format, api, w).await
}
cli::Commands::Config { action } => {
commands::config::execute(action, server, format, api, w).await
}
cli::Commands::Product { action } => {
commands::product::execute(action, server, format, api, w).await
}
cli::Commands::Field { action } => {
commands::field::execute(action, server, format, api, w).await
}
cli::Commands::User { action } => {
commands::user::execute(action, server, format, api, w).await
}
cli::Commands::Group { action } => {
commands::group::execute(action, server, format, api, w).await
}
cli::Commands::Whoami { action } => {
let whoami_action = action.as_ref().unwrap_or(&cli::WhoamiAction::Show);
commands::whoami::execute(whoami_action, server, format, api, w).await
}
cli::Commands::Server { action } => {
commands::server::execute(action, server, format, api, w).await
}
cli::Commands::Classification { action } => {
commands::classification::execute(action, server, format, api, w).await
}
cli::Commands::Component { action } => {
commands::component::execute(action, server, format, api, w).await
}
cli::Commands::Template { action } => {
commands::template::execute(action, server, format, api, w).await
}
cli::Commands::Query { action } => {
commands::query::execute(action, server, format, api, w).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;
#[cfg(test)]
#[path = "lib_tests.rs"]
mod tests;