Skip to content

Commit

Permalink
replace clap attributes with command and arg
Browse files Browse the repository at this point in the history
even though `#[clap()]` still works, `#[command()]` and `#[arg()]` are now
recommended since clap v4, ref clap-rs/clap#4180

Signed-off-by: runsisi <[email protected]>
  • Loading branch information
runsisi authored and jeromegn committed Sep 2, 2024
1 parent 7289573 commit e35acab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions crates/corro-devcluster/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@ use std::{
use crate::topology::Simple;

#[derive(Parser)]
#[clap(version = env!("CARGO_PKG_VERSION"))]
#[command(version = env!("CARGO_PKG_VERSION"))]
struct Cli {
/// Set the state directory path. If not set the environment
/// variable CORRO_DEVCLUSTER_STATE_DIR will be used
#[clap(long = "statedir", short = 'd', global = true)]
#[arg(long = "statedir", short = 'd', global = true)]
state_directory: Option<PathBuf>,

/// Set the state directory path. If not set the environment
/// variable CORRO_DEVCLUSTER_SCHEMA_DIR will be used
#[clap(long = "schemadir", short = 's', global = true)]
#[arg(long = "schemadir", short = 's', global = true)]
schema_directory: Option<PathBuf>,

/// Provide the binary path for corrosion. If none is provided,
/// corrosion will be built with nix (which may take a minute)
#[clap(long = "binpath", short = 'b', global = true)]
#[arg(long = "binpath", short = 'b', global = true)]
binary_path: Option<String>,

#[command(subcommand)]
Expand Down
10 changes: 5 additions & 5 deletions crates/corrosion/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -543,24 +543,24 @@ fn main() {
}

#[derive(Parser)]
#[clap(version = VERSION)]
#[command(version = VERSION)]
struct Cli {
/// Set the config file path
#[clap(
#[arg(
long = "config",
short,
global = true,
default_value = "/etc/corrosion/config.toml"
)]
config_path: Utf8PathBuf,

#[clap(long, global = true)]
#[arg(long, global = true)]
api_addr: Option<SocketAddr>,

#[clap(long, global = true)]
#[arg(long, global = true)]
db_path: Option<Utf8PathBuf>,

#[clap(long, global = true)]
#[arg(long, global = true)]
admin_path: Option<Utf8PathBuf>,

#[command(subcommand)]
Expand Down

0 comments on commit e35acab

Please sign in to comment.