From f6e2d5857baff52c4fc5af6569de43d445b64738 Mon Sep 17 00:00:00 2001 From: ace Date: Sun, 5 Mar 2023 10:59:48 +0300 Subject: [PATCH] update to use clap 4 --- src/main.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index f1157a9..7f0dae6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,7 +2,7 @@ use serde_yaml; use serde::{Deserialize, Serialize}; use octocrab; use telegram_bot::*; -use clap::Clap; +use clap::Parser; use std::future::Future; use std::time::Duration; use futures; @@ -44,7 +44,8 @@ impl Repo { } -#[derive(Clap)] +#[derive(Parser, Debug)] +#[clap(author, version, about, long_about = None)] struct Opts { /// Config file #[clap(long, default_value = "config.yaml")] @@ -65,8 +66,8 @@ struct Opts { #[clap(long, allow_hyphen_values(true))] chatid: i64, /// Verbose level, accept multiple occurrences - #[clap(short, long, parse(from_occurrences))] - verbose: usize, + #[clap(short, long, action = clap::ArgAction::Count)] + verbose: u8, } #[tokio::main] @@ -74,7 +75,7 @@ async fn main() -> Result<(), Box> { let opts: Opts = Opts::parse(); stderrlog::new() .module(module_path!()) - .verbosity(opts.verbose+1) + .verbosity(usize::from(opts.verbose+1)) .timestamp(stderrlog::Timestamp::Second) .quiet(false) .init()