From 5d935414ea5f25a1d865a60df9d573bfbf5508b0 Mon Sep 17 00:00:00 2001 From: Dominik Werder Date: Wed, 12 Jan 2022 18:59:43 +0100 Subject: [PATCH] Update clap --- daqbuffer/Cargo.toml | 4 ++-- daqbuffer/src/cli.rs | 4 ++-- dq/Cargo.toml | 2 +- dq/src/bin/daq-convert.rs | 28 +++++++++++++--------------- dq/src/bin/dq.rs | 4 ++-- 5 files changed, 20 insertions(+), 22 deletions(-) diff --git a/daqbuffer/Cargo.toml b/daqbuffer/Cargo.toml index 03a0b35..f7adbd4 100644 --- a/daqbuffer/Cargo.toml +++ b/daqbuffer/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Dominik Werder "] edition = "2018" [dependencies] -tokio = { version = "1.7.1", features = ["rt-multi-thread", "io-util", "net", "time", "sync", "fs"] } +tokio = { version = "=1.14.77", features = ["rt-multi-thread", "io-util", "net", "time", "sync", "fs"] } hyper = "0.14" http = "0.2" tracing = "0.1.25" @@ -22,7 +22,7 @@ serde_derive = "1.0" serde_json = "1.0" chrono = "0.4" url = "2.2.2" -clap = "3.0.0-beta.5" +clap = { version = "3.0.6", features = ["derive", "cargo"] } lazy_static = "1.4.0" err = { path = "../err" } taskrun = { path = "../taskrun" } diff --git a/daqbuffer/src/cli.rs b/daqbuffer/src/cli.rs index 98ad7b1..93b9572 100644 --- a/daqbuffer/src/cli.rs +++ b/daqbuffer/src/cli.rs @@ -1,7 +1,7 @@ -use clap::{crate_authors, crate_version, Parser}; +use clap::Parser; #[derive(Debug, Parser)] -#[clap(name="daqbuffer", author=crate_authors!(), version=crate_version!())] +#[clap(name = "daqbuffer", author, version)] pub struct Opts { #[clap(short, long, parse(from_occurrences))] pub verbose: i32, diff --git a/dq/Cargo.toml b/dq/Cargo.toml index 54b39e2..8546793 100644 --- a/dq/Cargo.toml +++ b/dq/Cargo.toml @@ -12,7 +12,7 @@ path = "src/dq.rs" #serde_json = "1.0" tokio = { version = "1.14.77", features = ["rt-multi-thread", "io-util", "net", "time", "sync", "fs"] } futures-util = "0.3.14" -clap = "3.0.0-beta.5" +clap = { version = "3.0.6", features = ["derive", "cargo"] } chrono = "0.4.19" bytes = "1.0.1" err = { path = "../err" } diff --git a/dq/src/bin/daq-convert.rs b/dq/src/bin/daq-convert.rs index 3d18bd9..50fe24c 100644 --- a/dq/src/bin/daq-convert.rs +++ b/dq/src/bin/daq-convert.rs @@ -1,10 +1,10 @@ -use clap::{crate_version, Parser}; +use clap::Parser; use err::Error; use netpod::{timeunits::*, Nanos}; use std::{path::PathBuf, str::FromStr}; #[derive(Debug, Parser)] -#[clap(name="DAQ buffer tools", version=crate_version!())] +#[clap(name = "DAQ buffer tools", version)] pub struct Opts { #[clap(short, long, parse(from_occurrences))] pub verbose: u32, @@ -14,28 +14,26 @@ pub struct Opts { #[derive(Debug, Parser)] pub enum SubCmd { - #[clap(about = "Convert a channel from the Archiver Appliance into Databuffer format.")] + /// Convert a channel from the Archiver Appliance into Databuffer format. ConvertArchiverApplianceChannel(ConvertArchiverApplianceChannel), } #[derive(Debug, Parser)] pub struct ConvertArchiverApplianceChannel { - #[clap( - long, - about = "Prefix for keyspaces, e.g. specify `daq` to get scalar keyspace directory `daq_2`." - )] + /// Prefix for keyspaces, e.g. specify `daq` to get scalar keyspace directory `daq_2`. + #[clap(long)] keyspace_prefix: String, - #[clap(long, about = "Name of the channel to convert.")] + /// Name of the channel to convert. + #[clap(long)] channel_name: String, - #[clap(long, about = "Look for archiver appliance data at given path.")] + /// Look for archiver appliance data at given path. + #[clap(long)] input_dir: PathBuf, - #[clap(long, about = "Generate Databuffer format at given path.")] + /// Generate Databuffer format at given path. + #[clap(long)] output_dir: PathBuf, - #[clap( - default_value = "1d", - long, - about = "Size of the time-bins in the generated Databuffer format.\nUnit-suffixes: `h` (hours), `d` (days)" - )] + /// Size of the time-bins in the generated Databuffer format.\nUnit-suffixes: `h` (hours), `d` (days) + #[clap(default_value = "1d", long)] time_bin_size: TimeBinSize, } diff --git a/dq/src/bin/dq.rs b/dq/src/bin/dq.rs index caeb441..7c84447 100644 --- a/dq/src/bin/dq.rs +++ b/dq/src/bin/dq.rs @@ -1,4 +1,4 @@ -use clap::{crate_version, Parser}; +use clap::Parser; //use disk::decode::EventValueShape; //use disk::decode::EventValuesDim0Case; use disk::eventchunker::EventChunkerConf; @@ -14,7 +14,7 @@ use tokio::fs::File; use tokio::io::AsyncReadExt; #[derive(Debug, Parser)] -#[clap(name="DAQ buffer tools", version=crate_version!())] +#[clap(name = "DAQ buffer tools", version)] pub struct Opts { #[clap(short, long, parse(from_occurrences))] pub verbose: u32,