From 4ba4b002353dc0808262296bf5ee4739f0a2512c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 29 Sep 2022 09:48:53 +0300 Subject: [PATCH] examples: Update to clap 4 --- generic/sodium/Cargo.toml | 2 +- generic/sodium/examples/decrypt_example.rs | 7 +++---- generic/sodium/examples/encrypt_example.rs | 11 +++++++---- generic/sodium/examples/generate_keys.rs | 11 +++++++---- generic/threadshare/Cargo.toml | 2 +- utils/uriplaylistbin/Cargo.toml | 2 +- utils/uriplaylistbin/examples/playlist.rs | 5 ++--- 7 files changed, 22 insertions(+), 18 deletions(-) diff --git a/generic/sodium/Cargo.toml b/generic/sodium/Cargo.toml index 736e2a03..fda10690 100644 --- a/generic/sodium/Cargo.toml +++ b/generic/sodium/Cargo.toml @@ -17,7 +17,7 @@ hex = "0.4" smallvec = "1.0" # example -clap = { version = "3.2", optional = true, features = ["derive"] } +clap = { version = "4", optional = true, features = ["derive"] } serde = { version = "1.0", features = ["derive"], optional = true } serde_json = { version = "1.0", optional = true } diff --git a/generic/sodium/examples/decrypt_example.rs b/generic/sodium/examples/decrypt_example.rs index bd87bd6d..5a0a9d2f 100644 --- a/generic/sodium/examples/decrypt_example.rs +++ b/generic/sodium/examples/decrypt_example.rs @@ -34,15 +34,14 @@ use clap::Parser; use serde::{Deserialize, Serialize}; #[derive(Parser, Debug)] -#[clap(version, author)] -#[clap(about = "Decrypt a gstsodium10 file")] +#[clap(version, author, about = "Decrypt a gstsodium10 file")] struct Args { /// File to encrypt - #[clap(short, long, action)] + #[clap(short, long)] input: String, /// File to decrypt - #[clap(short, long, action)] + #[clap(short, long)] output: String, } diff --git a/generic/sodium/examples/encrypt_example.rs b/generic/sodium/examples/encrypt_example.rs index d4b215b9..c8cd97bf 100644 --- a/generic/sodium/examples/encrypt_example.rs +++ b/generic/sodium/examples/encrypt_example.rs @@ -34,15 +34,18 @@ use clap::Parser; use serde::{Deserialize, Serialize}; #[derive(Parser, Debug)] -#[clap(version, author)] -#[clap(about = "Encrypt a file with in the gstsodium10 format")] +#[clap( + version, + author, + about = "Encrypt a file with in the gstsodium10 format" +)] struct Args { /// File to encrypt - #[clap(short, long, action)] + #[clap(short, long)] input: String, /// File to decrypt - #[clap(short, long, action)] + #[clap(short, long)] output: String, } diff --git a/generic/sodium/examples/generate_keys.rs b/generic/sodium/examples/generate_keys.rs index 106830b2..4186eb4b 100644 --- a/generic/sodium/examples/generate_keys.rs +++ b/generic/sodium/examples/generate_keys.rs @@ -29,15 +29,18 @@ use std::fs::File; use std::path::PathBuf; #[derive(Parser, Debug)] -#[clap(version, author)] -#[clap(about = "Generate a pair of Sodium's crypto_box_curve25519xsalsa20poly1305 keys.")] +#[clap( + version, + author, + about = "Generate a pair of Sodium's crypto_box_curve25519xsalsa20poly1305 keys." +)] struct Args { /// Path to write the Keys - #[clap(short, long, action)] + #[clap(short, long)] path: PathBuf, /// Write a JSON file instead of a key.prv/key.pub pair - #[clap(short, long, action)] + #[clap(short, long)] json: bool, } diff --git a/generic/threadshare/Cargo.toml b/generic/threadshare/Cargo.toml index cd14971a..7503de9c 100644 --- a/generic/threadshare/Cargo.toml +++ b/generic/threadshare/Cargo.toml @@ -27,7 +27,7 @@ socket2 = {features = ["all"], version = "0.4"} waker-fn = "1.1" # Used by examples -clap = { version = "3.2", features = ["derive"], optional = true } +clap = { version = "4", features = ["derive"], optional = true } [target.'cfg(windows)'.dependencies] winapi = { version = "0.3.9", features = ["winsock2", "processthreadsapi"] } diff --git a/utils/uriplaylistbin/Cargo.toml b/utils/uriplaylistbin/Cargo.toml index ded337ca..508337c9 100644 --- a/utils/uriplaylistbin/Cargo.toml +++ b/utils/uriplaylistbin/Cargo.toml @@ -12,7 +12,7 @@ rust-version = "1.63" gst = { package = "gstreamer", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } once_cell = "1.0" anyhow = "1" -clap = { version = "3.2", optional = true, features = ["derive"] } +clap = { version = "4", optional = true, features = ["derive"] } [dev-dependencies] gst-app = { package = "gstreamer-app", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } diff --git a/utils/uriplaylistbin/examples/playlist.rs b/utils/uriplaylistbin/examples/playlist.rs index fdbf779f..3ea879c6 100644 --- a/utils/uriplaylistbin/examples/playlist.rs +++ b/utils/uriplaylistbin/examples/playlist.rs @@ -16,10 +16,9 @@ use clap::Parser; use gst::prelude::*; #[derive(Debug, Parser)] -#[clap(version, author)] -#[clap(about = "An example of uriplaylistbin usage.")] +#[clap(version, author, about = "An example of uriplaylistbin usage.")] struct Opt { - #[clap(short, default_value = "1", action)] + #[clap(short, default_value = "1")] iterations: u32, uris: Vec, }