mirror of
https://gitea.0xace.cc/rust/github-release-bot.git
synced 2025-02-23 03:34:46 +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 serde::{Deserialize, Serialize};
|
||||||
use octocrab;
|
use octocrab;
|
||||||
use telegram_bot::*;
|
use telegram_bot::*;
|
||||||
use clap::Clap;
|
use clap::Parser;
|
||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use futures;
|
use futures;
|
||||||
@ -44,7 +44,8 @@ impl Repo {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clap)]
|
#[derive(Parser, Debug)]
|
||||||
|
#[clap(author, version, about, long_about = None)]
|
||||||
struct Opts {
|
struct Opts {
|
||||||
/// Config file
|
/// Config file
|
||||||
#[clap(long, default_value = "config.yaml")]
|
#[clap(long, default_value = "config.yaml")]
|
||||||
@ -65,8 +66,8 @@ struct Opts {
|
|||||||
#[clap(long, allow_hyphen_values(true))]
|
#[clap(long, allow_hyphen_values(true))]
|
||||||
chatid: i64,
|
chatid: i64,
|
||||||
/// Verbose level, accept multiple occurrences
|
/// Verbose level, accept multiple occurrences
|
||||||
#[clap(short, long, parse(from_occurrences))]
|
#[clap(short, long, action = clap::ArgAction::Count)]
|
||||||
verbose: usize,
|
verbose: u8,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
@ -74,7 +75,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
let opts: Opts = Opts::parse();
|
let opts: Opts = Opts::parse();
|
||||||
stderrlog::new()
|
stderrlog::new()
|
||||||
.module(module_path!())
|
.module(module_path!())
|
||||||
.verbosity(opts.verbose+1)
|
.verbosity(usize::from(opts.verbose+1))
|
||||||
.timestamp(stderrlog::Timestamp::Second)
|
.timestamp(stderrlog::Timestamp::Second)
|
||||||
.quiet(false)
|
.quiet(false)
|
||||||
.init()
|
.init()
|
||||||
|
Loading…
Reference in New Issue
Block a user