pub mod aave;
pub mod block;
pub mod cancel;
pub mod command;
pub mod context;
pub mod database;
pub mod error;
pub mod exchange;
pub mod fleet;
pub mod operator;
pub mod path;
pub mod pool;
pub mod prompt;
pub mod report;
pub use aave::{resolve_aave_deployment, AaveCommand, AaveDeployment, AAVE_DEPLOYMENTS};
pub use block::{
parse_to_block, resolve_chain_selector, resolve_to_block, BlockTag, ToBlockSpec,
DEFAULT_CHUNK_SIZE, DEFAULT_TO_BLOCK, DEFAULT_VERIFY_ALL_INTERVAL,
};
pub use cancel::CancelHandle;
pub use command::{Command, DatabaseCommand};
pub use context::CliContext;
pub use database::database_backup_path;
pub use error::{CliError, ExitCode};
pub use exchange::{
resolve_deployment, ExchangeCommand, ExchangeDeployment, PoolManagerDeployment,
RETIRED_EXCHANGES,
};
pub use fleet::FleetCommand;
pub use operator::{
parse_hop_token, parse_sim_intake_floor, render_json_sorted, resolve_socket,
validate_posture_patch, PathDirection, PathFamily, PathStep, PosturePatchEntry,
PosturePatchValue, WireRequest, WireResponse, FLEET_POSTURE_THRESHOLD_KEYS,
SIM_INTAKE_FLOOR_RESTORE, SOCKET_DEFAULT, SOCKET_ENV,
};
pub use path::PathCommand;
pub use pool::{PoolCommand, PoolFamily};
pub use prompt::{PromptPlan, Prompter};
pub use report::{
schema_state_label, AavePositionLine, AaveReport, AaveUpdateEntry, AaveUpdateOutcome,
ActivateOutcome, CommandOutcome, CommandReport, CutoverOutcome, DatabaseReport,
DeactivateOutcome, DryRunKind, ExchangeReport, FleetReport, PathReport, PoolReport,
};
#[must_use]
pub fn run(command: &Command, ctx: &CliContext<'_>, prompter: &dyn Prompter) -> CommandOutcome {
run_with_cancel(command, ctx, prompter, &CancelHandle::new())
}
#[must_use]
pub fn run_with_cancel(
command: &Command,
ctx: &CliContext<'_>,
prompter: &dyn Prompter,
cancel: &CancelHandle,
) -> CommandOutcome {
let result = command.execute_with_cancel(ctx, prompter, cancel);
let exit_code = match &result {
Ok(_) => ExitCode::Success,
Err(err) => ExitCode::from(err),
};
CommandOutcome::new(result, exit_code)
}