Update to clap 4.0

This commit is contained in:
Joscha 2022-09-29 12:47:02 +02:00
parent ec34a45f2b
commit 3895388e54
4 changed files with 19 additions and 37 deletions

View file

@ -37,11 +37,11 @@ pub struct Args {
rooms: Vec<String>,
/// Export all rooms.
#[clap(long, short)]
#[arg(long, short)]
all: bool,
/// Format of the output file.
#[clap(long, short, value_enum, default_value_t = Format::Text)]
#[arg(long, short, value_enum, default_value_t = Format::Text)]
format: Format,
/// Location of the output file
@ -55,8 +55,8 @@ pub struct Args {
/// `%r.%e` will be appended.
///
/// Must be a valid utf-8 encoded string.
#[clap(long, short, default_value_t = Into::into("%r.%e"))]
#[clap(verbatim_doc_comment)]
#[arg(long, short, default_value_t = Into::into("%r.%e"))]
#[arg(verbatim_doc_comment)]
out: String,
}

View file

@ -41,7 +41,7 @@ use vault::Vault;
use crate::config::Config;
use crate::logger::Logger;
#[derive(Debug, clap::Subcommand)]
#[derive(Debug, clap::Parser)]
enum Command {
/// Run the client interactively (default).
Run,
@ -60,34 +60,34 @@ impl Default for Command {
}
#[derive(Debug, clap::Parser)]
#[clap(version)]
#[command(version)]
struct Args {
/// Path to the config file.
///
/// Relative paths are interpreted relative to the current directory.
#[clap(long, short)]
#[arg(long, short)]
config: Option<PathBuf>,
/// Path to a directory for cove to store its data in.
///
/// Relative paths are interpreted relative to the current directory.
#[clap(long, short)]
#[arg(long, short)]
data_dir: Option<PathBuf>,
/// If set, cove won't store data permanently.
#[clap(long, short, action)]
#[arg(long, short)]
ephemeral: bool,
/// If set, cove will ignore the autojoin config option.
#[clap(long, short, action)]
#[arg(long, short)]
offline: bool,
/// Measure the width of characters as displayed by the terminal emulator
/// instead of guessing the width.
#[clap(long, short, action)]
#[arg(long, short)]
measure_widths: bool,
#[clap(subcommand)]
#[command(subcommand)]
command: Option<Command>,
}