Skip to content

Commit 88d4cc6

Browse files
committed
chore: update clap dependency from v3 to v4
Signed-off-by: Matheus Cardoso <matheus@cardo.so>
1 parent b3b1692 commit 88d4cc6

File tree

22 files changed

+440
-307
lines changed

22 files changed

+440
-307
lines changed

Cargo.lock

Lines changed: 64 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ async-trait = "0.1"
1717
bindle = { workspace = true }
1818
bytes = "1.1"
1919
chrono = "0.4"
20-
clap = { version = "3.1.15", features = ["derive", "env"] }
20+
clap = { version = "4.1", features = ["derive", "env"] }
21+
clap_complete = { version = "4.1", optional = true }
22+
clap_complete_fig = { version = "4.1", optional = true }
2123
cloud = { path = "crates/cloud" }
2224
cloud-openapi = { git = "https://github.com/fermyon/cloud-openapi" }
2325
comfy-table = "5.0"
@@ -80,12 +82,13 @@ vergen = { version = "7", default-features = false, features = [
8082
] }
8183

8284
[features]
83-
default = []
85+
default = ["generate-completions"]
8486
e2e-tests = []
8587
outbound-redis-tests = []
8688
config-provider-tests = []
8789
outbound-pg-tests = []
8890
outbound-mysql-tests = []
91+
generate-completions = ["dep:clap_complete", "dep:clap_complete_fig"]
8992

9093
[workspace]
9194
members = [

crates/abi-conformance/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ edition = { workspace = true }
77
[dependencies]
88
anyhow = "1.0.44"
99
cap-std = "0.26.1"
10-
clap = { version = "3.1.15", features = ["derive", "env"] }
10+
clap = { version = "4.1", features = ["derive", "env"] }
1111
rand = "0.8.5"
1212
rand_chacha = "0.3.1"
1313
rand_core = "0.6.3"

crates/abi-conformance/src/bin/spin-abi-conformance.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@ use std::{
88
use wasmtime::{Config, Engine, Module};
99

1010
#[derive(Parser)]
11-
#[clap(author, version, about)]
11+
#[command(author, version, about)]
1212
pub struct Options {
1313
/// Name of Wasm file to test (or stdin if not specified)
14-
#[clap(short, long)]
14+
#[arg(short, long)]
1515
pub input: Option<PathBuf>,
1616

1717
/// Name of JSON file to write report to (or stdout if not specified)
18-
#[clap(short, long)]
18+
#[arg(short, long)]
1919
pub output: Option<PathBuf>,
2020

2121
/// Name of TOML configuration file to use
22-
#[clap(short, long)]
22+
#[arg(short, long)]
2323
pub config: Option<PathBuf>,
2424
}
2525

crates/http/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ doctest = false
1010
[dependencies]
1111
anyhow = "1.0"
1212
async-trait = "0.1"
13-
clap = "3"
13+
clap = "4.1"
1414
futures = "0.3"
1515
futures-util = "0.3.8"
1616
http = "0.2"

crates/http/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ mod wagi;
88
use std::{
99
collections::HashMap,
1010
future::ready,
11-
net::{Ipv4Addr, SocketAddr, ToSocketAddrs},
11+
net::{Ipv4Addr, SocketAddr, SocketAddrV4, ToSocketAddrs},
1212
path::PathBuf,
1313
sync::Arc,
1414
};
@@ -59,15 +59,15 @@ pub struct HttpTrigger {
5959
#[derive(Args)]
6060
pub struct CliArgs {
6161
/// IP address and port to listen on
62-
#[clap(long = "listen", default_value = "127.0.0.1:3000", value_parser = parse_listen_addr)]
62+
#[arg(long = "listen", default_value_t = std::net::SocketAddr::V4(SocketAddrV4::new(Ipv4Addr::new(127, 0, 0, 1), 3000)), value_parser = parse_listen_addr)]
6363
pub address: SocketAddr,
6464

6565
/// The path to the certificate to use for https, if this is not set, normal http will be used. The cert should be in PEM format
66-
#[clap(long, env = "SPIN_TLS_CERT", requires = "tls-key")]
66+
#[arg(long, env = "SPIN_TLS_CERT", requires = "tls_key")]
6767
pub tls_cert: Option<PathBuf>,
6868

6969
/// The path to the certificate key to use for https, if this is not set, normal http will be used. The key should be in PKCS#8 format
70-
#[clap(long, env = "SPIN_TLS_KEY", requires = "tls-cert")]
70+
#[arg(long, env = "SPIN_TLS_KEY", requires = "tls_cert")]
7171
pub tls_key: Option<PathBuf>,
7272
}
7373

crates/trigger/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ edition = { workspace = true }
77
[dependencies]
88
anyhow = "1.0"
99
async-trait = "0.1"
10-
clap = { version = "3.1.15", features = ["derive", "env"] }
10+
clap = { version = "4.1", features = ["derive", "env"] }
1111
ctrlc = { version = "3.2", features = ["termination"] }
1212
dirs = "4"
1313
futures = "0.3"

crates/trigger/src/cli.rs

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::path::PathBuf;
22

33
use anyhow::{Context, Result};
4-
use clap::{Args, IntoApp, Parser};
4+
use clap::{Args, CommandFactory, Parser};
55
use serde::de::DeserializeOwned;
66
use tokio::{
77
task::JoinHandle,
@@ -24,69 +24,67 @@ pub const SPIN_WORKING_DIR: &str = "SPIN_WORKING_DIR";
2424

2525
/// A command that runs a TriggerExecutor.
2626
#[derive(Parser, Debug)]
27-
#[clap(next_help_heading = "TRIGGER OPTIONS")]
27+
#[command(next_help_heading = "TRIGGER OPTIONS")]
2828
pub struct TriggerExecutorCommand<Executor: TriggerExecutor>
2929
where
3030
Executor::RunConfig: Args,
3131
{
3232
/// Log directory for the stdout and stderr of components.
33-
#[clap(
34-
name = APP_LOG_DIR,
35-
short = 'L',
36-
long = "log-dir",
37-
)]
33+
#[arg(
34+
short = 'L',
35+
long = "log-dir",
36+
id = APP_LOG_DIR,
37+
)]
3838
pub log: Option<PathBuf>,
3939

4040
/// Disable Wasmtime cache.
41-
#[clap(
42-
name = DISABLE_WASMTIME_CACHE,
41+
#[arg(
4342
long = "disable-cache",
43+
id = DISABLE_WASMTIME_CACHE,
4444
env = DISABLE_WASMTIME_CACHE,
45-
conflicts_with = WASMTIME_CACHE_FILE,
46-
takes_value = false,
45+
conflicts_with = WASMTIME_CACHE_FILE
4746
)]
4847
pub disable_cache: bool,
4948

5049
/// Wasmtime cache configuration file.
51-
#[clap(
52-
name = WASMTIME_CACHE_FILE,
50+
#[arg(
5351
long = "cache",
52+
id = WASMTIME_CACHE_FILE,
5453
env = WASMTIME_CACHE_FILE,
5554
conflicts_with = DISABLE_WASMTIME_CACHE,
5655
)]
5756
pub cache: Option<PathBuf>,
5857

5958
/// Print output for given component(s) to stdout/stderr
60-
#[clap(
61-
name = FOLLOW_LOG_OPT,
59+
#[arg(
6260
long = "follow",
63-
multiple_occurrences = true,
64-
)]
61+
id = FOLLOW_LOG_OPT
62+
)]
6563
pub follow_components: Vec<String>,
6664

6765
/// Print all component output to stdout/stderr
68-
#[clap(
66+
#[arg(
6967
long = "follow-all",
70-
conflicts_with = FOLLOW_LOG_OPT,
71-
)]
68+
conflicts_with = FOLLOW_LOG_OPT
69+
)]
7270
pub follow_all_components: bool,
7371

7472
/// Set the static assets of the components in the temporary directory as writable.
75-
#[clap(long = "allow-transient-write")]
73+
#[arg(long)]
7674
pub allow_transient_write: bool,
7775

7876
/// Configuration file for config providers and wasmtime config.
79-
#[clap(
80-
name = RUNTIME_CONFIG_FILE,
77+
#[arg(
8178
long = "runtime-config-file",
79+
id = RUNTIME_CONFIG_FILE,
8280
env = RUNTIME_CONFIG_FILE,
8381
)]
8482
pub runtime_config_file: Option<PathBuf>,
8583

86-
#[clap(flatten)]
84+
#[command(flatten)]
8785
pub run_config: Executor::RunConfig,
8886

89-
#[clap(long = "help-args-only", hide = true)]
87+
#[arg(long, hide = true)]
9088
pub help_args_only: bool,
9189

9290
#[clap(long = "oci")]

0 commit comments

Comments
 (0)