examples: Update to clap 4

This commit is contained in:
Sebastian Dröge 2022-09-29 09:48:53 +03:00
parent 0b81ed2e34
commit 4ba4b00235
7 changed files with 22 additions and 18 deletions

View file

@ -17,7 +17,7 @@ hex = "0.4"
smallvec = "1.0" smallvec = "1.0"
# example # 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 = { version = "1.0", features = ["derive"], optional = true }
serde_json = { version = "1.0", optional = true } serde_json = { version = "1.0", optional = true }

View file

@ -34,15 +34,14 @@ use clap::Parser;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
#[derive(Parser, Debug)] #[derive(Parser, Debug)]
#[clap(version, author)] #[clap(version, author, about = "Decrypt a gstsodium10 file")]
#[clap(about = "Decrypt a gstsodium10 file")]
struct Args { struct Args {
/// File to encrypt /// File to encrypt
#[clap(short, long, action)] #[clap(short, long)]
input: String, input: String,
/// File to decrypt /// File to decrypt
#[clap(short, long, action)] #[clap(short, long)]
output: String, output: String,
} }

View file

@ -34,15 +34,18 @@ use clap::Parser;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
#[derive(Parser, Debug)] #[derive(Parser, Debug)]
#[clap(version, author)] #[clap(
#[clap(about = "Encrypt a file with in the gstsodium10 format")] version,
author,
about = "Encrypt a file with in the gstsodium10 format"
)]
struct Args { struct Args {
/// File to encrypt /// File to encrypt
#[clap(short, long, action)] #[clap(short, long)]
input: String, input: String,
/// File to decrypt /// File to decrypt
#[clap(short, long, action)] #[clap(short, long)]
output: String, output: String,
} }

View file

@ -29,15 +29,18 @@ use std::fs::File;
use std::path::PathBuf; use std::path::PathBuf;
#[derive(Parser, Debug)] #[derive(Parser, Debug)]
#[clap(version, author)] #[clap(
#[clap(about = "Generate a pair of Sodium's crypto_box_curve25519xsalsa20poly1305 keys.")] version,
author,
about = "Generate a pair of Sodium's crypto_box_curve25519xsalsa20poly1305 keys."
)]
struct Args { struct Args {
/// Path to write the Keys /// Path to write the Keys
#[clap(short, long, action)] #[clap(short, long)]
path: PathBuf, path: PathBuf,
/// Write a JSON file instead of a key.prv/key.pub pair /// Write a JSON file instead of a key.prv/key.pub pair
#[clap(short, long, action)] #[clap(short, long)]
json: bool, json: bool,
} }

View file

@ -27,7 +27,7 @@ socket2 = {features = ["all"], version = "0.4"}
waker-fn = "1.1" waker-fn = "1.1"
# Used by examples # Used by examples
clap = { version = "3.2", features = ["derive"], optional = true } clap = { version = "4", features = ["derive"], optional = true }
[target.'cfg(windows)'.dependencies] [target.'cfg(windows)'.dependencies]
winapi = { version = "0.3.9", features = ["winsock2", "processthreadsapi"] } winapi = { version = "0.3.9", features = ["winsock2", "processthreadsapi"] }

View file

@ -12,7 +12,7 @@ rust-version = "1.63"
gst = { package = "gstreamer", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } gst = { package = "gstreamer", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
once_cell = "1.0" once_cell = "1.0"
anyhow = "1" anyhow = "1"
clap = { version = "3.2", optional = true, features = ["derive"] } clap = { version = "4", optional = true, features = ["derive"] }
[dev-dependencies] [dev-dependencies]
gst-app = { package = "gstreamer-app", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } gst-app = { package = "gstreamer-app", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }

View file

@ -16,10 +16,9 @@ use clap::Parser;
use gst::prelude::*; use gst::prelude::*;
#[derive(Debug, Parser)] #[derive(Debug, Parser)]
#[clap(version, author)] #[clap(version, author, about = "An example of uriplaylistbin usage.")]
#[clap(about = "An example of uriplaylistbin usage.")]
struct Opt { struct Opt {
#[clap(short, default_value = "1", action)] #[clap(short, default_value = "1")]
iterations: u32, iterations: u32,
uris: Vec<String>, uris: Vec<String>,
} }