Update clap

This commit is contained in:
Austen Adler 2023-05-17 21:36:14 -04:00
parent 342e59727a
commit 453b4e97c2
17 changed files with 214 additions and 84 deletions

241
Cargo.lock generated
View File

@ -17,29 +17,24 @@ version = "1.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20e59b2ccb4c1ffbbf45af6f493e16ac65a66981c85664f1587816c0b08cd698" checksum = "20e59b2ccb4c1ffbbf45af6f493e16ac65a66981c85664f1587816c0b08cd698"
[[package]]
name = "atty"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
"hermit-abi",
"libc",
"winapi",
]
[[package]]
name = "autocfg"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
[[package]] [[package]]
name = "bitflags" name = "bitflags"
version = "1.3.2" version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitflags"
version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6776fc96284a0bb647b615056fc496d1fe1644a7ab01829818a6d91cae888b84"
[[package]]
name = "cc"
version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
[[package]] [[package]]
name = "cfg-if" name = "cfg-if"
version = "1.0.0" version = "1.0.0"
@ -48,26 +43,24 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]] [[package]]
name = "clap" name = "clap"
version = "3.0.10" version = "4.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a30c3bf9ff12dfe5dae53f0a96e0febcd18420d1c0e7fad77796d9d5c4b5375" checksum = "42dfd32784433290c51d92c438bb72ea5063797fc3cc9a21a8c4346bebbb2098"
dependencies = [ dependencies = [
"atty", "bitflags 2.3.1",
"bitflags",
"clap_derive", "clap_derive",
"indexmap", "clap_lex",
"lazy_static", "is-terminal",
"os_str_bytes", "once_cell",
"strsim", "strsim",
"termcolor", "termcolor",
"textwrap",
] ]
[[package]] [[package]]
name = "clap_derive" name = "clap_derive"
version = "3.0.6" version = "4.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "517358c28fcef6607bf6f76108e02afad7e82297d132a6b846dcc1fc3efcd153" checksum = "fddf67631444a3a3e3e5ac51c36a5e01335302de677bd78759eaa90ab1f46644"
dependencies = [ dependencies = [
"heck", "heck",
"proc-macro-error", "proc-macro-error",
@ -76,6 +69,42 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "clap_lex"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "033f6b7a4acb1f358c742aaca805c939ee73b4c6209ae4318ec7aca81c42e646"
dependencies = [
"os_str_bytes",
]
[[package]]
name = "either"
version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91"
[[package]]
name = "errno"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a"
dependencies = [
"errno-dragonfly",
"libc",
"windows-sys",
]
[[package]]
name = "errno-dragonfly"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"
dependencies = [
"cc",
"libc",
]
[[package]] [[package]]
name = "evalexpr" name = "evalexpr"
version = "7.0.1" version = "7.0.1"
@ -93,12 +122,6 @@ dependencies = [
"wasi", "wasi",
] ]
[[package]]
name = "hashbrown"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
[[package]] [[package]]
name = "heck" name = "heck"
version = "0.4.0" version = "0.4.0"
@ -107,21 +130,40 @@ checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
[[package]] [[package]]
name = "hermit-abi" name = "hermit-abi"
version = "0.1.19" version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286"
[[package]]
name = "io-lifetimes"
version = "1.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220"
dependencies = [ dependencies = [
"hermit-abi",
"libc", "libc",
"windows-sys",
] ]
[[package]] [[package]]
name = "indexmap" name = "is-terminal"
version = "1.8.0" version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282a6247722caba404c065016bbfa522806e51714c34f5dfc3e4a3a46fcb4223" checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f"
dependencies = [ dependencies = [
"autocfg", "hermit-abi",
"hashbrown", "io-lifetimes",
"rustix",
"windows-sys",
]
[[package]]
name = "itertools"
version = "0.10.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473"
dependencies = [
"either",
] ]
[[package]] [[package]]
@ -137,7 +179,9 @@ version = "0.1.0"
dependencies = [ dependencies = [
"alphanumeric-sort", "alphanumeric-sort",
"clap", "clap",
"either",
"evalexpr", "evalexpr",
"itertools",
"kakplugin", "kakplugin",
"linked-hash-map", "linked-hash-map",
"linked_hash_set", "linked_hash_set",
@ -147,17 +191,11 @@ dependencies = [
"strum_macros", "strum_macros",
] ]
[[package]]
name = "lazy_static"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.113" version = "0.2.144"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eef78b64d87775463c549fbd80e19249ef436ea3bf1de2a1eb7e717ec7fab1e9" checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1"
[[package]] [[package]]
name = "linked-hash-map" name = "linked-hash-map"
@ -174,20 +212,29 @@ dependencies = [
"linked-hash-map", "linked-hash-map",
] ]
[[package]]
name = "linux-raw-sys"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ece97ea872ece730aed82664c424eb4c8291e1ff2480247ccf7409044bc6479f"
[[package]] [[package]]
name = "memchr" name = "memchr"
version = "2.4.1" version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
[[package]]
name = "once_cell"
version = "1.17.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3"
[[package]] [[package]]
name = "os_str_bytes" name = "os_str_bytes"
version = "6.0.0" version = "6.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64" checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64"
dependencies = [
"memchr",
]
[[package]] [[package]]
name = "ppv-lite86" name = "ppv-lite86"
@ -221,11 +268,11 @@ dependencies = [
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.36" version = "1.0.58"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029" checksum = "fa1fb82fc0c281dd9671101b66b771ebbe1eaf967b96ac8740dcba4b70005ca8"
dependencies = [ dependencies = [
"unicode-xid", "unicode-ident",
] ]
[[package]] [[package]]
@ -284,6 +331,20 @@ version = "0.6.25"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
[[package]]
name = "rustix"
version = "0.37.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acf8729d8542766f1b2cf77eb034d52f40d375bb8b615d0b147089946e16613d"
dependencies = [
"bitflags 1.3.2",
"errno",
"io-lifetimes",
"libc",
"linux-raw-sys",
"windows-sys",
]
[[package]] [[package]]
name = "rustversion" name = "rustversion"
version = "1.0.7" version = "1.0.7"
@ -345,10 +406,10 @@ dependencies = [
] ]
[[package]] [[package]]
name = "textwrap" name = "unicode-ident"
version = "0.14.2" version = "1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0066c8d12af8b5acd21e00547c3797fde4e8677254a7ee429176ccebbe93dd80" checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4"
[[package]] [[package]]
name = "unicode-xid" name = "unicode-xid"
@ -398,3 +459,69 @@ name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0" version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows-sys"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
dependencies = [
"windows-targets",
]
[[package]]
name = "windows-targets"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc"
[[package]]
name = "windows_aarch64_msvc"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3"
[[package]]
name = "windows_i686_gnu"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241"
[[package]]
name = "windows_i686_msvc"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00"
[[package]]
name = "windows_x86_64_gnu"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953"
[[package]]
name = "windows_x86_64_msvc"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"

View File

@ -32,7 +32,7 @@ image = "scratch"
[dependencies] [dependencies]
regex = "1" regex = "1"
clap = {version = "3", features = ["derive", "env"]} clap = { version = "4", features = ["derive", "env"] }
alphanumeric-sort = "1" alphanumeric-sort = "1"
# shellwords = {version = "1", path = "../../../git/rust-shellwords/"} # shellwords = {version = "1", path = "../../../git/rust-shellwords/"}
# shellwords = "1" # shellwords = "1"
@ -43,6 +43,8 @@ linked-hash-map = "0.5.4"
linked_hash_set = "0.1.4" linked_hash_set = "0.1.4"
strum_macros = "0.24" strum_macros = "0.24"
strum = { version = "0.24", features = ["derive"] } strum = { version = "0.24", features = ["derive"] }
itertools = "0.10.5"
either = "1.8.1"
[profile.release] [profile.release]
lto = true lto = true

View File

@ -71,7 +71,7 @@ pub struct SelectionWithSubselections {
// } // }
// } // }
#[derive(Clone, PartialEq, PartialOrd, Ord, Eq, Debug)] #[derive(Copy, Clone, PartialEq, PartialOrd, Ord, Eq, Debug)]
pub struct SelectionDesc { pub struct SelectionDesc {
pub left: AnchorPosition, pub left: AnchorPosition,
pub right: AnchorPosition, pub right: AnchorPosition,

View File

@ -2,7 +2,7 @@ use kakplugin::{
get_selections_desc, set_selections_desc, AnchorPosition, KakError, SelectionDesc, get_selections_desc, set_selections_desc, AnchorPosition, KakError, SelectionDesc,
}; };
use std::cmp::{max, min}; use std::cmp::{max, min};
#[derive(clap::StructOpt, Debug)] #[derive(clap::Args, Debug)]
pub struct Options { pub struct Options {
/// Bounding box mode, which selects the largest box to contain everything /// Bounding box mode, which selects the largest box to contain everything
#[clap(short, long, help = "Select the bonding box of all selections")] #[clap(short, long, help = "Select the bonding box of all selections")]

View File

@ -2,7 +2,7 @@ use evalexpr::{eval, Value};
use kakplugin::{get_selections, set_selections, KakError}; use kakplugin::{get_selections, set_selections, KakError};
use std::borrow::Cow; use std::borrow::Cow;
#[derive(clap::StructOpt, Debug)] #[derive(clap::Args, Debug)]
pub struct Options { pub struct Options {
#[clap(index = 1, help = "Amount to increment/decrement", default_value = "1")] #[clap(index = 1, help = "Amount to increment/decrement", default_value = "1")]
amount: isize, amount: isize,

View File

@ -1,7 +1,7 @@
use kakplugin::{ use kakplugin::{
get_selections_desc, set_selections_desc, types::MaybeSplit, KakError, SelectionDesc, get_selections_desc, set_selections_desc, types::MaybeSplit, KakError, SelectionDesc,
}; };
#[derive(clap::StructOpt, Debug)] #[derive(clap::Args, Debug)]
pub struct Options { pub struct Options {
#[clap(short, long, help = "Do not include newlines")] #[clap(short, long, help = "Do not include newlines")]
no_newline: bool, no_newline: bool,

View File

@ -1,6 +1,6 @@
use kakplugin::{get_selections_desc_unordered, set_selections_desc, KakError}; use kakplugin::{get_selections_desc_unordered, set_selections_desc, KakError};
#[derive(clap::StructOpt, Debug)] #[derive(clap::Args, Debug)]
pub struct Options; pub struct Options;
pub fn join(_options: &Options) -> Result<String, KakError> { pub fn join(_options: &Options) -> Result<String, KakError> {

View File

@ -2,7 +2,7 @@ use evalexpr::{eval, Value};
use kakplugin::{get_selections, set_selections, KakError}; use kakplugin::{get_selections, set_selections, KakError};
use std::borrow::Cow; use std::borrow::Cow;
#[derive(clap::StructOpt, Debug)] #[derive(clap::Args, Debug)]
pub struct Options; pub struct Options;
pub fn math_eval(_options: &Options) -> Result<String, KakError> { pub fn math_eval(_options: &Options) -> Result<String, KakError> {
let mut err_count: usize = 0; let mut err_count: usize = 0;

View File

@ -2,7 +2,7 @@ use crate::utils::split_newlines;
use kakplugin::{get_selections, set_selections, KakError}; use kakplugin::{get_selections, set_selections, KakError};
use std::borrow::Cow; use std::borrow::Cow;
#[derive(clap::StructOpt, Debug)] #[derive(clap::Args, Debug)]
pub struct Options { pub struct Options {
#[clap(index = 1, help = "Pad with this char", default_value = "0")] #[clap(index = 1, help = "Pad with this char", default_value = "0")]
fill: char, fill: char,

View File

@ -1,5 +1,5 @@
use kakplugin::{get_selections, set_selections, KakError}; use kakplugin::{get_selections, set_selections, KakError};
#[derive(clap::StructOpt, Debug)] #[derive(clap::Args, Debug)]
pub struct Options; pub struct Options;
pub fn rev(_options: &Options) -> Result<String, KakError> { pub fn rev(_options: &Options) -> Result<String, KakError> {

View File

@ -10,11 +10,10 @@ use std::{borrow::Cow, io::Write, str::FromStr};
const KAK_BUFFER_NAME: &str = "*kakplugin-set*"; const KAK_BUFFER_NAME: &str = "*kakplugin-set*";
#[derive(clap::StructOpt, Debug)] #[derive(clap::Args, Debug)]
pub struct Options { pub struct Options {
#[clap( #[clap(
min_values = 1, num_args = 1..=3,
max_values = 3,
allow_hyphen_values = true, allow_hyphen_values = true,
help = "Register operation and operand. Empty register is current selection. Example: 'a-b' or '+b'" help = "Register operation and operand. Empty register is current selection. Example: 'a-b' or '+b'"
)] )]

View File

@ -1,6 +1,6 @@
use kakplugin::{get_selections, set_selections, KakError}; use kakplugin::{get_selections, set_selections, KakError};
use rand::{seq::SliceRandom, thread_rng}; use rand::{seq::SliceRandom, thread_rng};
#[derive(clap::StructOpt, Debug)] #[derive(clap::Args, Debug)]
pub struct Options; pub struct Options;
pub fn shuf(_options: &Options) -> Result<String, KakError> { pub fn shuf(_options: &Options) -> Result<String, KakError> {
let mut selections = get_selections(None)?; let mut selections = get_selections(None)?;

View File

@ -1,9 +1,10 @@
use alphanumeric_sort::compare_str; use alphanumeric_sort::compare_str;
use clap::ArgAction;
use kakplugin::{self, get_selections_with_desc, open_command_fifo, KakError, SelectionWithDesc}; use kakplugin::{self, get_selections_with_desc, open_command_fifo, KakError, SelectionWithDesc};
use regex::Regex; use regex::Regex;
use std::{borrow::Cow, cmp::Ordering, io::Write}; use std::{borrow::Cow, cmp::Ordering, io::Write};
#[derive(clap::StructOpt, Debug)] #[derive(clap::Args, Debug)]
pub struct Options { pub struct Options {
#[clap(index = 1, help = "Optional regex comparison key")] #[clap(index = 1, help = "Optional regex comparison key")]
regex: Option<Regex>, regex: Option<Regex>,
@ -14,7 +15,8 @@ pub struct Options {
)] )]
subselections_register: Option<char>, subselections_register: Option<char>,
// TODO: Can we invert a boolean? This name is terrible // TODO: Can we invert a boolean? This name is terrible
#[clap(short = 'S', long, parse(try_from_str = invert_bool), default_value_t, help = "Do not treat trimmed value of selections when sorting")] // #[clap(short = 'S', long, value_parser = invert_bool, default_value_t, help = "Do not treat trimmed value of selections when sorting")]
#[clap(short = 'S', long, action = ArgAction::SetFalse, default_value_t, help = "Do not treat trimmed value of selections when sorting")]
no_skip_whitespace: bool, no_skip_whitespace: bool,
#[clap(short = 'L', long, help = "Do not sort numbers lexicographically")] #[clap(short = 'L', long, help = "Do not sort numbers lexicographically")]
no_lexicographic_sort: bool, no_lexicographic_sort: bool,
@ -24,14 +26,14 @@ pub struct Options {
ignore_case: bool, ignore_case: bool,
} }
fn invert_bool(s: &str) -> Result<bool, &'static str> { // fn invert_bool(s: &str) -> Result<bool, &'static str> {
// Invert the boolean // // Invert the boolean
match s { // match s {
"false" => Ok(true), // "false" => Ok(true),
"true" => Ok(false), // "true" => Ok(false),
_ => Err("Unparsable boolean value"), // _ => Err("Unparsable boolean value"),
} // }
} // }
struct SortableSelection<'a> { struct SortableSelection<'a> {
/// The content of the selection /// The content of the selection

View File

@ -1,7 +1,7 @@
use kakplugin::{get_selections, open_command_fifo, KakError}; use kakplugin::{get_selections, open_command_fifo, KakError};
use std::io::Write; use std::io::Write;
#[derive(clap::StructOpt, Debug)] #[derive(clap::Args, Debug)]
pub struct Options { pub struct Options {
#[clap(short, long, help = "Trim from left")] #[clap(short, long, help = "Trim from left")]
left: bool, left: bool,

View File

@ -6,7 +6,7 @@ use kakplugin::{
use regex::Regex; use regex::Regex;
use std::collections::BTreeSet; use std::collections::BTreeSet;
#[derive(clap::StructOpt, Debug)] #[derive(clap::Args, Debug)]
pub struct Options { pub struct Options {
#[clap(index = 1, help = "Optional regex to compare unique elements")] #[clap(index = 1, help = "Optional regex to compare unique elements")]
regex: Option<Regex>, regex: Option<Regex>,

View File

@ -3,7 +3,7 @@ use std::{
io::{BufRead, BufReader, Write}, io::{BufRead, BufReader, Write},
process::{Command, Stdio}, process::{Command, Stdio},
}; };
#[derive(clap::StructOpt, Debug)] #[derive(clap::Args, Debug)]
pub struct Options { pub struct Options {
#[clap()] #[clap()]
command: String, command: String,

View File

@ -8,7 +8,7 @@ use std::{
}, },
}; };
#[derive(clap::StructOpt, Debug)] #[derive(clap::Args, Debug)]
pub struct Options { pub struct Options {
#[clap(help = "Register with the lookup table", default_value = "\"")] #[clap(help = "Register with the lookup table", default_value = "\"")]
register: Register, register: Register,