1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-07-29 22:01:14 +03:00

Migrate to clap v4

This commit is contained in:
Quentin Gliech
2022-09-29 14:13:25 +02:00
parent 645d019d10
commit f5e3aa0404
8 changed files with 14 additions and 14 deletions

View File

@ -19,7 +19,7 @@ use tracing::info;
#[derive(Parser, Debug)] #[derive(Parser, Debug)]
pub(super) struct Options { pub(super) struct Options {
#[clap(subcommand)] #[command(subcommand)]
subcommand: Subcommand, subcommand: Subcommand,
} }

View File

@ -19,7 +19,7 @@ use mas_storage::MIGRATOR;
#[derive(Parser, Debug)] #[derive(Parser, Debug)]
pub(super) struct Options { pub(super) struct Options {
#[clap(subcommand)] #[command(subcommand)]
subcommand: Subcommand, subcommand: Subcommand,
} }

View File

@ -24,7 +24,7 @@ use tracing::info;
#[derive(Parser, Debug)] #[derive(Parser, Debug)]
pub(super) struct Options { pub(super) struct Options {
#[clap(subcommand)] #[command(subcommand)]
subcommand: Subcommand, subcommand: Subcommand,
} }
@ -33,11 +33,11 @@ enum Subcommand {
/// Perform an HTTP request with the default HTTP client /// Perform an HTTP request with the default HTTP client
Http { Http {
/// Show response headers /// Show response headers
#[clap(long, short = 'I')] #[arg(long, short = 'I')]
show_headers: bool, show_headers: bool,
/// Parse the response as JSON /// Parse the response as JSON
#[clap(long, short = 'j')] #[arg(long, short = 'j')]
json: bool, json: bool,
/// URI where to perform a GET request /// URI where to perform a GET request

View File

@ -25,7 +25,7 @@ use tracing::{info, warn};
#[derive(Parser, Debug)] #[derive(Parser, Debug)]
pub(super) struct Options { pub(super) struct Options {
#[clap(subcommand)] #[command(subcommand)]
subcommand: Subcommand, subcommand: Subcommand,
} }
@ -43,7 +43,7 @@ enum Subcommand {
/// Import clients from config /// Import clients from config
ImportClients { ImportClients {
/// Remove all clients before importing /// Remove all clients before importing
#[clap(long)] #[arg(long)]
truncate: bool, truncate: bool,
}, },
} }

View File

@ -49,10 +49,10 @@ enum Subcommand {
#[derive(Parser, Debug)] #[derive(Parser, Debug)]
pub struct Options { pub struct Options {
/// Path to the configuration file /// Path to the configuration file
#[clap(short, long, global = true, multiple_occurrences(true))] #[arg(short, long, global = true, action = clap::ArgAction::Append)]
config: Vec<PathBuf>, config: Vec<PathBuf>,
#[clap(subcommand)] #[command(subcommand)]
subcommand: Option<Subcommand>, subcommand: Option<Subcommand>,
} }

View File

@ -37,11 +37,11 @@ use tracing::{error, info};
#[derive(Parser, Debug, Default)] #[derive(Parser, Debug, Default)]
pub(super) struct Options { pub(super) struct Options {
/// Automatically apply pending migrations /// Automatically apply pending migrations
#[clap(long)] #[arg(long)]
migrate: bool, migrate: bool,
/// Watch for changes for templates on the filesystem /// Watch for changes for templates on the filesystem
#[clap(short, long)] #[arg(short, long)]
watch: bool, watch: bool,
} }

View File

@ -32,7 +32,7 @@ enum Subcommand {
path: PathBuf, path: PathBuf,
/// Overwrite existing template files /// Overwrite existing template files
#[clap(long)] #[arg(long)]
overwrite: bool, overwrite: bool,
}, },
@ -42,7 +42,7 @@ enum Subcommand {
path: String, path: String,
/// Skip loading builtin templates /// Skip loading builtin templates
#[clap(long)] #[arg(long)]
skip_builtin: bool, skip_builtin: bool,
}, },
} }

View File

@ -20,7 +20,7 @@
use std::path::PathBuf; use std::path::PathBuf;
use anyhow::Context; use anyhow::Context;
use clap::StructOpt; use clap::Parser;
use mas_config::TelemetryConfig; use mas_config::TelemetryConfig;
use tracing_subscriber::{ use tracing_subscriber::{
filter::LevelFilter, layer::SubscriberExt, reload, util::SubscriberInitExt, EnvFilter, Layer, filter::LevelFilter, layer::SubscriberExt, reload, util::SubscriberInitExt, EnvFilter, Layer,