Skip to content

Commit c98adda

Browse files
authored
chore: replace deprecated clap attributes
superseeds #5962 Pull-Request: #5964.
1 parent f104b2f commit c98adda

File tree

6 files changed

+24
-24
lines changed

6 files changed

+24
-24
lines changed

examples/autonatv2/src/bin/autonatv2_server.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ use libp2p::{
1414
use rand::rngs::OsRng;
1515

1616
#[derive(Debug, Parser)]
17-
#[clap(name = "libp2p autonatv2 server")]
17+
#[command(name = "libp2p autonatv2 server")]
1818
struct Opt {
19-
#[clap(short, long, default_value_t = 0)]
19+
#[arg(short, long, default_value_t = 0)]
2020
listen_port: u16,
2121
}
2222

examples/dcutr/src/main.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,22 @@ use libp2p::{
3333
use tracing_subscriber::EnvFilter;
3434

3535
#[derive(Debug, Parser)]
36-
#[clap(name = "libp2p DCUtR client")]
36+
#[command(name = "libp2p DCUtR client")]
3737
struct Opts {
3838
/// The mode (client-listen, client-dial).
39-
#[clap(long)]
39+
#[arg(long)]
4040
mode: Mode,
4141

4242
/// Fixed value to generate deterministic peer id.
43-
#[clap(long)]
43+
#[arg(long)]
4444
secret_key_seed: u8,
4545

4646
/// The listening address
47-
#[clap(long)]
47+
#[arg(long)]
4848
relay_address: Multiaddr,
4949

5050
/// Peer ID of the remote peer to hole punch to.
51-
#[clap(long)]
51+
#[arg(long)]
5252
remote_peer_id: Option<PeerId>,
5353
}
5454

examples/file-sharing/src/main.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,32 +117,32 @@ async fn main() -> Result<(), Box<dyn Error>> {
117117
}
118118

119119
#[derive(Parser, Debug)]
120-
#[clap(name = "libp2p file sharing example")]
120+
#[command(name = "libp2p file sharing example")]
121121
struct Opt {
122122
/// Fixed value to generate deterministic peer ID.
123-
#[clap(long)]
123+
#[arg(long)]
124124
secret_key_seed: Option<u8>,
125125

126-
#[clap(long)]
126+
#[arg(long)]
127127
peer: Option<Multiaddr>,
128128

129-
#[clap(long)]
129+
#[arg(long)]
130130
listen_address: Option<Multiaddr>,
131131

132-
#[clap(subcommand)]
132+
#[command(subcommand)]
133133
argument: CliArgument,
134134
}
135135

136136
#[derive(Debug, Parser)]
137137
enum CliArgument {
138138
Provide {
139-
#[clap(long)]
139+
#[arg(long)]
140140
path: PathBuf,
141-
#[clap(long)]
141+
#[arg(long)]
142142
name: String,
143143
},
144144
Get {
145-
#[clap(long)]
145+
#[arg(long)]
146146
name: String,
147147
},
148148
}

examples/ipfs-kad/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,16 +154,16 @@ async fn main() -> Result<()> {
154154
}
155155

156156
#[derive(Parser, Debug)]
157-
#[clap(name = "libp2p Kademlia DHT example")]
157+
#[command(name = "libp2p Kademlia DHT example")]
158158
struct Opt {
159-
#[clap(subcommand)]
159+
#[command(subcommand)]
160160
argument: CliArgument,
161161
}
162162

163163
#[derive(Debug, Parser)]
164164
enum CliArgument {
165165
GetPeers {
166-
#[clap(long)]
166+
#[arg(long)]
167167
peer_id: Option<PeerId>,
168168
},
169169
PutPkRecord {},

examples/relay-server/src/main.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,17 +119,17 @@ fn generate_ed25519(secret_key_seed: u8) -> identity::Keypair {
119119
}
120120

121121
#[derive(Debug, Parser)]
122-
#[clap(name = "libp2p relay")]
122+
#[command(name = "libp2p relay")]
123123
struct Opt {
124124
/// Determine if the relay listen on ipv6 or ipv4 loopback address. the default is ipv4
125-
#[clap(long)]
125+
#[arg(long)]
126126
use_ipv6: Option<bool>,
127127

128128
/// Fixed value to generate deterministic peer id
129-
#[clap(long)]
129+
#[arg(long)]
130130
secret_key_seed: u8,
131131

132132
/// The port used to listen on all interfaces
133-
#[clap(long)]
133+
#[arg(long)]
134134
port: u16,
135135
}

protocols/perf/src/bin/perf.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use tracing_subscriber::EnvFilter;
3535
use web_time::{Duration, Instant};
3636

3737
#[derive(Debug, Parser)]
38-
#[clap(name = "libp2p perf client")]
38+
#[command(name = "libp2p perf client")]
3939
struct Opts {
4040
#[arg(long)]
4141
server_address: Option<SocketAddr>,
@@ -47,7 +47,7 @@ struct Opts {
4747
download_bytes: Option<usize>,
4848

4949
/// Run in server mode.
50-
#[clap(long)]
50+
#[arg(long)]
5151
run_server: bool,
5252
}
5353

0 commit comments

Comments
 (0)