From 5e2c438dabc74d7e87fad46c725501753a0a8a26 Mon Sep 17 00:00:00 2001 From: Conrad Ludgate Date: Tue, 18 Oct 2022 09:50:22 +0100 Subject: Upgrade clap (#568) --- src/command/client/history.rs | 16 ++++++++-------- src/command/client/import.rs | 2 +- src/command/client/search.rs | 20 ++++++++++---------- src/command/client/stats.rs | 2 +- src/command/client/sync.rs | 4 ++-- src/command/client/sync/login.rs | 3 +-- src/command/client/sync/register.rs | 3 +-- 7 files changed, 24 insertions(+), 26 deletions(-) (limited to 'src/command/client') diff --git a/src/command/client/history.rs b/src/command/client/history.rs index 07f4b319..6a78adc9 100644 --- a/src/command/client/history.rs +++ b/src/command/client/history.rs @@ -20,7 +20,7 @@ use log::debug; use super::search::format_duration; #[derive(Subcommand)] -#[clap(infer_subcommands = true)] +#[command(infer_subcommands = true)] pub enum Cmd { /// Begins a new command in the history Start { command: Vec }, @@ -28,33 +28,33 @@ pub enum Cmd { /// Finishes a new command in the history (adds time, exit code) End { id: String, - #[clap(long, short)] + #[arg(long, short)] exit: i64, }, /// List all items in history List { - #[clap(long, short)] + #[arg(long, short)] cwd: bool, - #[clap(long, short)] + #[arg(long, short)] session: bool, - #[clap(long)] + #[arg(long)] human: bool, /// Show only the text of the command - #[clap(long)] + #[arg(long)] cmd_only: bool, }, /// Get the last command ran Last { - #[clap(long)] + #[arg(long)] human: bool, /// Show only the text of the command - #[clap(long)] + #[arg(long)] cmd_only: bool, }, } diff --git a/src/command/client/import.rs b/src/command/client/import.rs index 60fd536d..b0375acd 100644 --- a/src/command/client/import.rs +++ b/src/command/client/import.rs @@ -14,7 +14,7 @@ use atuin_client::{ }; #[derive(Parser)] -#[clap(infer_subcommands = true)] +#[command(infer_subcommands = true)] pub enum Cmd { /// Import history for the current shell Auto, diff --git a/src/command/client/search.rs b/src/command/client/search.rs index 1cef1ffc..26026f34 100644 --- a/src/command/client/search.rs +++ b/src/command/client/search.rs @@ -18,45 +18,45 @@ pub use duration::format_duration; #[derive(Parser)] pub struct Cmd { /// Filter search result by directory - #[clap(long, short)] + #[arg(long, short)] cwd: Option, /// Exclude directory from results - #[clap(long = "exclude-cwd")] + #[arg(long = "exclude-cwd")] exclude_cwd: Option, /// Filter search result by exit code - #[clap(long, short)] + #[arg(long, short)] exit: Option, /// Exclude results with this exit code - #[clap(long = "exclude-exit")] + #[arg(long = "exclude-exit")] exclude_exit: Option, /// Only include results added before this date - #[clap(long, short)] + #[arg(long, short)] before: Option, /// Only include results after this date - #[clap(long)] + #[arg(long)] after: Option, /// How many entries to return at most - #[clap(long)] + #[arg(long)] limit: Option, /// Open interactive search UI - #[clap(long, short)] + #[arg(long, short)] interactive: bool, /// Use human-readable formatting for time - #[clap(long)] + #[arg(long)] human: bool, query: Vec, /// Show only the text of the command - #[clap(long)] + #[arg(long)] cmd_only: bool, } diff --git a/src/command/client/stats.rs b/src/command/client/stats.rs index 157496de..a00eb369 100644 --- a/src/command/client/stats.rs +++ b/src/command/client/stats.rs @@ -13,7 +13,7 @@ use atuin_client::{ }; #[derive(Parser)] -#[clap(infer_subcommands = true)] +#[command(infer_subcommands = true)] pub struct Cmd { /// compute statistics for the specified period, leave blank for statistics since the beginning period: Vec, diff --git a/src/command/client/sync.rs b/src/command/client/sync.rs index af809f3e..51fcbf63 100644 --- a/src/command/client/sync.rs +++ b/src/command/client/sync.rs @@ -8,12 +8,12 @@ mod logout; mod register; #[derive(Subcommand)] -#[clap(infer_subcommands = true)] +#[command(infer_subcommands = true)] pub enum Cmd { /// Sync with the configured server Sync { /// Force re-download everything - #[clap(long, short)] + #[arg(long, short)] force: bool, }, diff --git a/src/command/client/sync/login.rs b/src/command/client/sync/login.rs index 29222563..333a1514 100644 --- a/src/command/client/sync/login.rs +++ b/src/command/client/sync/login.rs @@ -1,6 +1,6 @@ use std::io; -use clap::{AppSettings, Parser}; +use clap::Parser; use eyre::Result; use tokio::{fs::File, io::AsyncWriteExt}; @@ -9,7 +9,6 @@ use atuin_common::api::LoginRequest; use rpassword::prompt_password; #[derive(Parser)] -#[clap(setting(AppSettings::DeriveDisplayOrder))] pub struct Cmd { #[clap(long, short)] pub username: Option, diff --git a/src/command/client/sync/register.rs b/src/command/client/sync/register.rs index 2b5b9ced..6b51fac8 100644 --- a/src/command/client/sync/register.rs +++ b/src/command/client/sync/register.rs @@ -1,11 +1,10 @@ -use clap::{AppSettings, Parser}; +use clap::Parser; use eyre::Result; use tokio::{fs::File, io::AsyncWriteExt}; use atuin_client::{api_client, settings::Settings}; #[derive(Parser)] -#[clap(setting(AppSettings::DeriveDisplayOrder))] pub struct Cmd { #[clap(long, short)] pub username: Option, -- cgit v1.3.1