Upgrade clap (#568)

This commit is contained in:
Conrad Ludgate 2022-10-18 09:50:22 +01:00 committed by GitHub
parent 3829f82d9c
commit 5e2c438dab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 58 additions and 58 deletions

24
Cargo.lock generated
View file

@ -331,35 +331,33 @@ dependencies = [
[[package]]
name = "clap"
version = "3.2.21"
version = "4.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ed5341b2301a26ab80be5cbdced622e80ed808483c52e45e3310a877d3b37d7"
checksum = "6bf8832993da70a4c6d13c581f4463c2bdda27b9bf1c5498dc4365543abe6d6f"
dependencies = [
"atty",
"bitflags",
"clap_derive",
"clap_lex",
"indexmap",
"once_cell",
"strsim",
"termcolor",
"textwrap",
]
[[package]]
name = "clap_complete"
version = "3.2.5"
version = "4.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f7a2e0a962c45ce25afce14220bc24f9dade0a1787f185cecf96bfba7847cd8"
checksum = "11cba7abac9b56dfe2f035098cdb3a43946f276e6db83b72c4e692343f9aab9a"
dependencies = [
"clap",
]
[[package]]
name = "clap_derive"
version = "3.2.18"
version = "4.0.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea0c8bce528c4be4da13ea6fead8965e95b6073585a2f05204bd8f4119f82a65"
checksum = "c42f169caba89a7d512b5418b09864543eeb4d497416c917d7137863bd2076ad"
dependencies = [
"heck",
"proc-macro-error",
@ -370,9 +368,9 @@ dependencies = [
[[package]]
name = "clap_lex"
version = "0.2.4"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5"
checksum = "0d4198f73e42b4936b35b5bb248d81d2b595ecb170da0bac7655c54eedfa8da8"
dependencies = [
"os_str_bytes",
]
@ -1953,12 +1951,6 @@ dependencies = [
"redox_termios",
]
[[package]]
name = "textwrap"
version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb"
[[package]]
name = "thiserror"
version = "1.0.34"

View file

@ -66,8 +66,8 @@ chrono-english = "0.1.4"
cli-table = { version = "0.4", default-features = false }
base64 = "0.13.0"
crossbeam-channel = "0.5.1"
clap = { version = "3.1.18", features = ["derive"] }
clap_complete = "3.1.4"
clap = { version = "4.0.14", features = ["derive"] }
clap_complete = "4.0.2"
fs-err = "2.7"
whoami = "1.1.2"
rpassword = "7.0"

View file

@ -14,14 +14,14 @@ mod search;
mod stats;
#[derive(Subcommand)]
#[clap(infer_subcommands = true)]
#[command(infer_subcommands = true)]
pub enum Cmd {
/// Manipulate shell history
#[clap(subcommand)]
#[command(subcommand)]
History(history::Cmd),
/// Import shell history from file
#[clap(subcommand)]
#[command(subcommand)]
Import(import::Cmd),
/// Calculate statistics for your history
@ -31,7 +31,7 @@ pub enum Cmd {
Search(search::Cmd),
#[cfg(feature = "sync")]
#[clap(flatten)]
#[command(flatten)]
Sync(sync::Cmd),
}

View file

@ -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<String> },
@ -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,
},
}

View file

@ -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,

View file

@ -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<String>,
/// Exclude directory from results
#[clap(long = "exclude-cwd")]
#[arg(long = "exclude-cwd")]
exclude_cwd: Option<String>,
/// Filter search result by exit code
#[clap(long, short)]
#[arg(long, short)]
exit: Option<i64>,
/// Exclude results with this exit code
#[clap(long = "exclude-exit")]
#[arg(long = "exclude-exit")]
exclude_exit: Option<i64>,
/// Only include results added before this date
#[clap(long, short)]
#[arg(long, short)]
before: Option<String>,
/// Only include results after this date
#[clap(long)]
#[arg(long)]
after: Option<String>,
/// How many entries to return at most
#[clap(long)]
#[arg(long)]
limit: Option<i64>,
/// 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<String>,
/// Show only the text of the command
#[clap(long)]
#[arg(long)]
cmd_only: bool,
}

View file

@ -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<String>,

View file

@ -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,
},

View file

@ -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<String>,

View file

@ -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<String>,

View file

@ -13,19 +13,19 @@ mod init;
mod contributors;
#[derive(Subcommand)]
#[clap(infer_subcommands = true)]
#[command(infer_subcommands = true)]
pub enum AtuinCmd {
#[cfg(feature = "client")]
#[clap(flatten)]
#[command(flatten)]
Client(client::Cmd),
/// Start an atuin server
#[cfg(feature = "server")]
#[clap(subcommand)]
#[command(subcommand)]
Server(server::Cmd),
/// Output shell setup
#[clap(subcommand)]
#[command(subcommand)]
Init(init::Cmd),
/// Generate a UUID
@ -36,11 +36,11 @@ pub enum AtuinCmd {
/// Generate shell completions
GenCompletions {
/// Set the shell for generating completions
#[clap(long, short)]
#[arg(long, short)]
shell: Shell,
/// Set the output directory
#[clap(long, short)]
#[arg(long, short)]
out_dir: Option<String>,
},
}

View file

@ -1,7 +1,7 @@
#![warn(clippy::pedantic, clippy::nursery)]
#![allow(clippy::use_self, clippy::missing_const_for_fn)] // not 100% reliable
use clap::{AppSettings, Parser};
use clap::Parser;
use eyre::Result;
use command::AtuinCmd;
@ -9,15 +9,25 @@ mod command;
const VERSION: &str = env!("CARGO_PKG_VERSION");
static HELP_TEMPLATE: &str = "\
{before-help}{name} {version}
{author}
{about}
{usage-heading}
{usage}
{all-args}{after-help}";
/// Magical shell history
#[derive(Parser)]
#[clap(
#[command(
author = "Ellie Huxtable <e@elm.sh>",
version = VERSION,
global_setting(AppSettings::DeriveDisplayOrder),
help_template(HELP_TEMPLATE),
)]
struct Atuin {
#[clap(subcommand)]
#[command(subcommand)]
atuin: AtuinCmd,
}