Skip to content

Commit ceea5b8

Browse files
refactor(rust): replace structopt with clap that was used in the file_transfer rust example
1 parent 19c416c commit ceea5b8

File tree

6 files changed

+21
-121
lines changed

6 files changed

+21
-121
lines changed

Cargo.lock

+10-105
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/rust/file_transfer/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ publish = false
88
rust-version = "1.56.0"
99

1010
[dependencies]
11+
clap = { version = "4.5", features = ["derive", "cargo", "wrap_help"] }
1112
ockam = { path = "../../../implementations/rust/ockam/ockam" }
1213
ockam_transport_tcp = { path = "../../../implementations/rust/ockam/ockam_transport_tcp" }
1314
serde = { version = "1.0", default-features = false, features = ["derive"] }
14-
structopt = { version = "0.3.25", default-features = false }
15-
tokio = { version = "1.36.0", features = ["fs", "io-util"] }
15+
tokio = { version = "1.36", features = ["fs", "io-util"] }
1616

1717
[dev-dependencies]
1818
example_test_helper = { path = "../../../tools/docs/example_test_helper" }

examples/rust/file_transfer/examples/sender.rs

+7-8
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,28 @@ use ockam::{Error, TcpConnectionOptions, TcpTransportExtension};
88

99
use std::path::PathBuf;
1010

11-
use structopt::StructOpt;
11+
use clap::Parser;
1212
use tokio::fs::File;
1313
use tokio::io::AsyncReadExt;
1414

15-
#[derive(Debug, StructOpt)]
16-
#[structopt(name = "sender", about = "An example of file transfer implemented with ockam.")]
17-
struct Opt {
15+
#[derive(Debug, Parser)]
16+
#[command(name = "sender", about = "An example of file transfer implemented with ockam.")]
17+
struct Sender {
1818
/// Input file
19-
#[structopt(parse(from_os_str))]
2019
input: PathBuf,
2120

2221
/// Forwarding address
23-
#[structopt(short, long)]
22+
#[arg(short, long)]
2423
address: String,
2524

2625
/// Sending chunk
27-
#[structopt(short, long, default_value = "8192")]
26+
#[arg(short, long, default_value = "8192")]
2827
chunk_size: usize,
2928
}
3029

3130
#[ockam::node]
3231
async fn main(ctx: Context) -> Result<()> {
33-
let opt = Opt::from_args();
32+
let opt = Sender::parse();
3433

3534
let node = node(ctx).await?;
3635
let tcp = node.create_tcp_transport().await?;

implementations/rust/ockam/ockam_app_lib/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,4 @@ tracing-core = { version = "0.1.32", default-features = false }
5151
tempfile = { version = "3.10.1" }
5252

5353
[build-dependencies]
54-
cbindgen = "0.26"
54+
cbindgen = { version = "0.26", default-features = false }

implementations/rust/ockam/ockam_command/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ path = "src/bin/ockam.rs"
5555
[dependencies]
5656
arboard = "3.3.2"
5757
async-trait = "0.1"
58-
clap = { version = "4.5.3", features = ["derive", "cargo", "wrap_help"] }
58+
clap = { version = "4.5", features = ["derive", "cargo", "wrap_help"] }
5959
clap_complete = "4.5.1"
6060
clap_mangen = "0.2.20"
6161
colorful = "0.2"

osv-scanner.toml

-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
[[IgnoredVulns]]
2-
id = "RUSTSEC-2021-0145"
3-
reason = "atty crate pulled in from transitive dependency env_logger used by kafka-protocol and quickcheck"
4-
51
[[IgnoredVulns]]
62
id = "RUSTSEC-2021-0127"
73
reason = "Unmaintained crate pulled-in by cddl-cat used for validating CDDL schema conformance in tests"

0 commit comments

Comments
 (0)