1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
pub(crate) mod logs;
mod shared;
pub(crate) mod start;
pub(crate) mod stop;
// TODO: remove once `network start` is removed
pub type StartCmd = start::Cmd;
// TODO: remove once `network top` is removed
pub type StopCmd = stop::Cmd;
#[derive(Debug, clap::Subcommand)]
pub enum Cmd {
/// Get logs from a running network container
Logs(logs::Cmd),
/// Start a container running a Stellar node, RPC, API, and friendbot (faucet).
///
/// `stellar network container start NETWORK [OPTIONS]`
///
/// By default, when starting a testnet container, without any optional arguments, it will run the equivalent of the following docker command:
///
/// `docker run --rm -p 8000:8000 --name stellar stellar/quickstart:testing --testnet --enable rpc,horizon`
Start(start::Cmd),
/// Stop a network container started with `network container start`.
Stop(stop::Cmd),
}
#[derive(thiserror::Error, Debug)]
pub enum Error {
#[error(transparent)]
Logs(#[from] logs::Error),
#[error(transparent)]
Start(#[from] start::Error),
#[error(transparent)]
Stop(#[from] stop::Error),
}
impl Cmd {
pub async fn run(&self) -> Result<(), Error> {
match &self {
Cmd::Logs(cmd) => cmd.run().await?,
Cmd::Start(cmd) => cmd.run().await?,
Cmd::Stop(cmd) => cmd.run().await?,
}
Ok(())
}
}