Update to clap 4

This commit is contained in:
Dominik Werder
2022-11-07 09:43:53 +01:00
parent 2d2721389d
commit 95f0c8f012
2 changed files with 16 additions and 15 deletions

View File

@@ -12,7 +12,7 @@ name = "daqingest"
path = "src/bin/daqingest.rs"
[dependencies]
clap = { version = "3", features = ["derive", "cargo"] }
clap = { version = "4.0.19", features = ["derive", "cargo"] }
chrono = "0.4"
bytes = "1.1"
scylla = "0.4"

View File

@@ -1,20 +1,21 @@
pub mod query;
use clap::ArgAction::Count;
use clap::Parser;
use netfetch::ca::ListenFromFileOpts;
use netfetch::zmtp::ZmtpClientOpts;
#[derive(Debug, Parser)]
//#[clap(name = "daqingest", version)]
#[clap(version)]
#[command(author, version, about)]
pub struct DaqIngestOpts {
#[clap(long, parse(from_occurrences))]
#[arg(long, action(Count))]
pub verbose: u32,
#[clap(long)]
pub tag: Option<String>,
#[clap(subcommand)]
#[command(subcommand)]
pub subcmd: SubCmd,
#[clap(long)]
#[arg(long)]
pub nworkers: Option<usize>,
}
@@ -25,25 +26,25 @@ pub enum SubCmd {
ListPulses,
FetchEvents(FetchEvents),
BsreadDump(BsreadDump),
#[clap(subcommand)]
#[command(subcommand)]
ChannelAccess(ChannelAccess),
}
#[derive(Debug, Parser)]
pub struct Bsread {
#[clap(long)]
#[arg(long)]
pub scylla: Vec<String>,
#[clap(long)]
#[arg(long)]
pub source: Vec<String>,
#[clap(long)]
#[arg(long)]
pub rcvbuf: Option<usize>,
#[clap(long)]
#[arg(long)]
pub array_truncate: Option<usize>,
#[clap(long)]
#[arg(long)]
pub do_pulse_id: bool,
#[clap(long)]
#[arg(long)]
pub skip_insert: bool,
#[clap(long)]
#[arg(long)]
pub process_channel_count_limit: Option<usize>,
}
@@ -63,9 +64,9 @@ impl From<Bsread> for ZmtpClientOpts {
#[derive(Debug, Parser)]
pub struct FetchEvents {
#[clap(long, min_values(1))]
#[arg(long, num_args(1..))]
pub scylla: Vec<String>,
#[clap(long)]
#[arg(long)]
pub channel: String,
}