-
|
In version 0.1, I implemented custom CLI flags/options by following this issue. However, in version 0.3, |
Beta Was this translation helpful? Give feedback.
Answered by
haoqixu
Oct 11, 2024
Replies: 1 comment 1 reply
-
|
use clap::Parser;
#[derive(Parser)]
struct MyOpt {
#[clap(short)]
something_cool: String,
#[clap(flatten)]
base_opts: Opt
}
fn main() {
let my_opts = MyOpt::from_args();
let mut my_server = Server::new(Some(my_opts.base_opts)).unwrap();Run with load_balancer
Command-line options
USAGE:
load_balancer [OPTIONS] -s <SOMETHING_COOL>
OPTIONS:
-c, --conf <CONF> The path to the configuration file.
-d, --daemon Whether this server should run in the background
-h, --help Print help information
-s <SOMETHING_COOL>
-t, --test This flag is useful for upgrading service where the user wants to
make sure the new service can start before shutting down the old
server process.
-u, --upgrade This is the base set of command line arguments for a pingora-based
service |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
h2cone
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
pingorais usingclap-3.xwhich also supportsflatten:Run with
-hflag and get:load_balancer Command-line options USAGE: load_balancer [OPTIONS] -s <SOMETHING_COOL> OPTIONS: -c, --conf <CONF> The path to the configuration file. -d, --daemon Whether this server should run in the background -h, --help Print help information -s <SOMETHING_COOL> -t, --test …