diff --git a/ol/cli/src/commands.rs b/ol/cli/src/commands.rs index d9cee8bb9c..fb24c09c2d 100644 --- a/ol/cli/src/commands.rs +++ b/ol/cli/src/commands.rs @@ -20,6 +20,7 @@ mod query_cmd; mod health_cmd; mod explorer_cmd; mod pilot_cmd; +mod start_cmd; use self::{ init_cmd::InitCmd, @@ -31,6 +32,7 @@ use self::{ query_cmd::QueryCmd, health_cmd::HealthCmd, pilot_cmd::PilotCmd, + start_cmd::StartCmd, }; use crate::entrypoint; @@ -88,8 +90,12 @@ pub enum OlCliCmd { Explorer(ExplorerCMD), /// The `explorer` subcommand - #[options(help = "run the 0L services")] + #[options(help = "run pilot command, which triggers needed services")] Pilot(PilotCmd), + + /// The `start` subcommand + #[options(help = "start 0L services")] + Start(StartCmd), } /// This trait allows you to define how application configuration is loaded. diff --git a/ol/cli/src/commands/pilot_cmd.rs b/ol/cli/src/commands/pilot_cmd.rs index 341ba1c7c4..4afd9d5e6e 100644 --- a/ol/cli/src/commands/pilot_cmd.rs +++ b/ol/cli/src/commands/pilot_cmd.rs @@ -1,9 +1,8 @@ -//! `monitor-cmd` subcommand +//! `pilot-cmd` subcommand use abscissa_core::{Command, Options, Runnable}; use crate::{check, node::client, entrypoint, node::node::Node, prelude::app_config}; -/// `pilot` subcommand #[derive(Command, Debug, Options)] pub struct PilotCmd { diff --git a/ol/cli/src/commands/start_cmd.rs b/ol/cli/src/commands/start_cmd.rs new file mode 100644 index 0000000000..db6b327be7 --- /dev/null +++ b/ol/cli/src/commands/start_cmd.rs @@ -0,0 +1,28 @@ +//! `start-cmd` subcommand + +use abscissa_core::{Command, Options, Runnable}; +use crate::{check, node::client, entrypoint, node::node::Node, prelude::app_config}; + +/// `pilot` subcommand + +#[derive(Command, Debug, Options)] +pub struct StartCmd { + /// Runs once, defaults to continuous + #[options(short = "o", help = "run once and exit, not continuous")] + once: bool, + /// Silent mode, defaults to verbose + #[options(short = "s", help = "run once and exit, not continuous")] + silent: bool +} + +impl Runnable for StartCmd { + /// Start the application. + fn run(&self) { + let args = entrypoint::get_args(); + let cfg = app_config().clone(); + let client = client::pick_client(args.swarm_path, &cfg).unwrap().0; + let mut node = Node::new(client, cfg); + + check::runner::run_checks(&mut node, true ,!self.once, !self.silent); + } +}