diff --git a/server/src/option.rs b/server/src/option.rs index fd5a2aef6..c1ea351b0 100644 --- a/server/src/option.rs +++ b/server/src/option.rs @@ -45,7 +45,7 @@ pub struct Config where S: Clone + clap::Args + StorageOpt, { - pub parseable: Opt, + pub parseable: Server, } impl Config @@ -53,14 +53,13 @@ where S: Clone + clap::Args + StorageOpt, { fn new() -> Self { - let parseable = match Opt::::try_parse() { + let Cli::Server::(args) = match Cli::::try_parse() { Ok(s) => s, Err(e) => { - eprintln!("You can also use the --demo flag to run Parseable with default object storage. For testing purposes only"); e.exit(); } }; - Config { parseable } + Config { parseable: args } } pub fn storage(&self) -> &S { @@ -148,13 +147,23 @@ where } } -#[derive(Debug, Clone, Parser)] +#[derive(Parser)] // requires `derive` feature #[command( name = "Parseable", - about = "Configuration for Parseable server", + bin_name = "parseable", + about = "Parseable is a log storage and observability platform.", version )] -pub struct Opt +enum Cli +where + S: Clone + clap::Args + StorageOpt, +{ + Server(Server), +} + +#[derive(clap::Args, Debug, Clone)] +#[clap(name = "server", about = "Start the Parseable server")] +pub struct Server where S: Clone + clap::Args + StorageOpt, { @@ -222,7 +231,7 @@ where pub demo: bool, } -impl Opt +impl Server where S: Clone + clap::Args + StorageOpt, {