mirror of
https://gitea.0xace.cc/rust/github-release-bot.git
synced 2025-02-22 11:24:45 +00:00
update to use clap 4
This commit is contained in:
parent
c52e24a78b
commit
f6e2d5857b
11
src/main.rs
11
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<dyn std::error::Error>> {
|
||||
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()
|
||||
|
Loading…
Reference in New Issue
Block a user