mirror of
https://github.com/Llewellynvdm/zoxide.git
synced 2024-11-21 20:35:15 +00:00
Updated clap to version 4.0 (#476)
Co-authored-by: Ajeet D'Souza <98ajeet@gmail.com>
This commit is contained in:
parent
1c947110db
commit
b7d6b1eea7
59
Cargo.lock
generated
59
Cargo.lock
generated
@ -131,8 +131,8 @@ checksum = "a3dbbb6653e7c55cc8595ad3e1f7be8f32aba4eb7ff7f0fd1163d4f3d137c0a9"
|
||||
dependencies = [
|
||||
"atty",
|
||||
"bitflags",
|
||||
"clap_derive",
|
||||
"clap_lex",
|
||||
"clap_derive 3.2.15",
|
||||
"clap_lex 0.2.4",
|
||||
"indexmap",
|
||||
"once_cell",
|
||||
"strsim",
|
||||
@ -141,21 +141,36 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_complete"
|
||||
version = "3.2.3"
|
||||
name = "clap"
|
||||
version = "4.0.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ead064480dfc4880a10764488415a97fdd36a4cf1bb022d372f02e8faf8386e1"
|
||||
checksum = "335867764ed2de42325fafe6d18b8af74ba97ee0c590fa016f157535b42ab04b"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"atty",
|
||||
"bitflags",
|
||||
"clap_derive 4.0.18",
|
||||
"clap_lex 0.3.0",
|
||||
"once_cell",
|
||||
"strsim",
|
||||
"termcolor",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_complete"
|
||||
version = "4.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dfe581a2035db4174cdbdc91265e1aba50f381577f0510d0ad36c7bc59cc84a3"
|
||||
dependencies = [
|
||||
"clap 4.0.18",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_complete_fig"
|
||||
version = "3.2.4"
|
||||
version = "4.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed37b4c0c1214673eba6ad8ea31666626bf72be98ffb323067d973c48b4964b9"
|
||||
checksum = "b36d1abc7184a737efc9f589e6e783e8b56c72e71fca748cf9947ed0a6f46d44"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"clap 4.0.18",
|
||||
"clap_complete",
|
||||
]
|
||||
|
||||
@ -172,6 +187,19 @@ dependencies = [
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_derive"
|
||||
version = "4.0.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "16a1b0f6422af32d5da0c58e2703320f379216ee70198241c84173a8c5ac28f3"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro-error",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_lex"
|
||||
version = "0.2.4"
|
||||
@ -181,6 +209,15 @@ dependencies = [
|
||||
"os_str_bytes",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_lex"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0d4198f73e42b4936b35b5bb248d81d2b595ecb170da0bac7655c54eedfa8da8"
|
||||
dependencies = [
|
||||
"os_str_bytes",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.8.11"
|
||||
@ -809,7 +846,7 @@ name = "xtask"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"clap",
|
||||
"clap 3.2.16",
|
||||
"ignore",
|
||||
"shell-words",
|
||||
]
|
||||
@ -822,7 +859,7 @@ dependencies = [
|
||||
"askama",
|
||||
"assert_cmd",
|
||||
"bincode",
|
||||
"clap",
|
||||
"clap 4.0.18",
|
||||
"clap_complete",
|
||||
"clap_complete_fig",
|
||||
"dirs",
|
||||
|
@ -22,7 +22,7 @@ members = ["xtask/"]
|
||||
anyhow = "1.0.32"
|
||||
askama = { version = "0.11.0", default-features = false }
|
||||
bincode = "1.3.1"
|
||||
clap = { version = "3.1.0", features = ["derive"] }
|
||||
clap = { version = "4.0.0", features = ["derive"] }
|
||||
dirs = "4.0.0"
|
||||
dunce = "1.0.1"
|
||||
fastrand = "1.7.0"
|
||||
@ -39,9 +39,9 @@ nix = { version = "0.24.1", default-features = false, features = [
|
||||
which = "4.2.5"
|
||||
|
||||
[build-dependencies]
|
||||
clap = { version = "3.1.0", features = ["derive"] }
|
||||
clap_complete = "3.1.0"
|
||||
clap_complete_fig = "3.1.0"
|
||||
clap = { version = "4.0.0", features = ["derive"] }
|
||||
clap_complete = "4.0.0"
|
||||
clap_complete_fig = "4.0.0"
|
||||
|
||||
[dev-dependencies]
|
||||
assert_cmd = "2.0.0"
|
||||
|
28
contrib/completions/zoxide.bash
generated
28
contrib/completions/zoxide.bash
generated
@ -8,24 +8,24 @@ _zoxide() {
|
||||
|
||||
for i in ${COMP_WORDS[@]}
|
||||
do
|
||||
case "${i}" in
|
||||
"$1")
|
||||
case "${cmd},${i}" in
|
||||
",$1")
|
||||
cmd="zoxide"
|
||||
;;
|
||||
add)
|
||||
cmd+="__add"
|
||||
zoxide,add)
|
||||
cmd="zoxide__add"
|
||||
;;
|
||||
import)
|
||||
cmd+="__import"
|
||||
zoxide,import)
|
||||
cmd="zoxide__import"
|
||||
;;
|
||||
init)
|
||||
cmd+="__init"
|
||||
zoxide,init)
|
||||
cmd="zoxide__init"
|
||||
;;
|
||||
query)
|
||||
cmd+="__query"
|
||||
zoxide,query)
|
||||
cmd="zoxide__query"
|
||||
;;
|
||||
remove)
|
||||
cmd+="__remove"
|
||||
zoxide,remove)
|
||||
cmd="zoxide__remove"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
@ -102,7 +102,7 @@ _zoxide() {
|
||||
return 0
|
||||
;;
|
||||
zoxide__query)
|
||||
opts="-i -l -s -h -V --all --interactive --list --score --exclude --help --version <KEYWORDS>..."
|
||||
opts="-i -l -s -h -V --all --interactive --list --score --exclude --help --version [KEYWORDS]..."
|
||||
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
|
||||
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
||||
return 0
|
||||
@ -120,7 +120,7 @@ _zoxide() {
|
||||
return 0
|
||||
;;
|
||||
zoxide__remove)
|
||||
opts="-i -h -V --interactive --help --version <PATHS>..."
|
||||
opts="-i -h -V --interactive --help --version [PATHS]..."
|
||||
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
|
||||
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
||||
return 0
|
||||
|
6
contrib/completions/zoxide.ts
generated
6
contrib/completions/zoxide.ts
generated
@ -28,6 +28,7 @@ const completion: Fig.Spec = {
|
||||
{
|
||||
name: "--from",
|
||||
description: "Application to import from",
|
||||
isRepeatable: true,
|
||||
args: {
|
||||
name: "from",
|
||||
suggestions: [
|
||||
@ -61,6 +62,7 @@ const completion: Fig.Spec = {
|
||||
{
|
||||
name: "--cmd",
|
||||
description: "Changes the prefix of the `z` and `zi` commands",
|
||||
isRepeatable: true,
|
||||
args: {
|
||||
name: "cmd",
|
||||
isOptional: true,
|
||||
@ -69,6 +71,7 @@ const completion: Fig.Spec = {
|
||||
{
|
||||
name: "--hook",
|
||||
description: "Changes how often zoxide increments a directory's score",
|
||||
isRepeatable: true,
|
||||
args: {
|
||||
name: "hook",
|
||||
isOptional: true,
|
||||
@ -113,6 +116,7 @@ const completion: Fig.Spec = {
|
||||
{
|
||||
name: "--exclude",
|
||||
description: "Exclude a path from results",
|
||||
isRepeatable: true,
|
||||
args: {
|
||||
name: "exclude",
|
||||
isOptional: true,
|
||||
@ -154,6 +158,7 @@ const completion: Fig.Spec = {
|
||||
],
|
||||
args: {
|
||||
name: "keywords",
|
||||
isVariadic: true,
|
||||
isOptional: true,
|
||||
},
|
||||
},
|
||||
@ -176,6 +181,7 @@ const completion: Fig.Spec = {
|
||||
],
|
||||
args: {
|
||||
name: "paths",
|
||||
isVariadic: true,
|
||||
isOptional: true,
|
||||
template: "folders",
|
||||
},
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
use std::path::PathBuf;
|
||||
|
||||
use clap::{ArgEnum, Parser, ValueHint};
|
||||
use clap::{Parser, ValueEnum, ValueHint};
|
||||
|
||||
const ENV_HELP: &str = "ENVIRONMENT VARIABLES:
|
||||
_ZO_DATA_DIR Path for zoxide data files
|
||||
@ -33,7 +33,7 @@ pub enum Cmd {
|
||||
/// Add a new directory or increment its rank
|
||||
#[derive(Debug, Parser)]
|
||||
pub struct Add {
|
||||
#[clap(min_values = 1, required = true, value_hint = ValueHint::DirPath)]
|
||||
#[clap(num_args = 1.., required = true, value_hint = ValueHint::DirPath)]
|
||||
pub paths: Vec<PathBuf>,
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ pub struct Import {
|
||||
pub path: PathBuf,
|
||||
|
||||
/// Application to import from
|
||||
#[clap(arg_enum, long)]
|
||||
#[clap(value_enum, long)]
|
||||
pub from: ImportFrom,
|
||||
|
||||
/// Merge into existing database
|
||||
@ -52,7 +52,7 @@ pub struct Import {
|
||||
pub merge: bool,
|
||||
}
|
||||
|
||||
#[derive(ArgEnum, Clone, Debug)]
|
||||
#[derive(ValueEnum, Clone, Debug)]
|
||||
pub enum ImportFrom {
|
||||
Autojump,
|
||||
Z,
|
||||
@ -61,7 +61,7 @@ pub enum ImportFrom {
|
||||
/// Generate shell configuration
|
||||
#[derive(Debug, Parser)]
|
||||
pub struct Init {
|
||||
#[clap(arg_enum)]
|
||||
#[clap(value_enum)]
|
||||
pub shell: InitShell,
|
||||
|
||||
/// Prevents zoxide from defining the `z` and `zi` commands
|
||||
@ -73,18 +73,18 @@ pub struct Init {
|
||||
pub cmd: String,
|
||||
|
||||
/// Changes how often zoxide increments a directory's score
|
||||
#[clap(arg_enum, long, default_value = "pwd")]
|
||||
#[clap(value_enum, long, default_value = "pwd")]
|
||||
pub hook: InitHook,
|
||||
}
|
||||
|
||||
#[derive(ArgEnum, Clone, Copy, Debug, Eq, PartialEq)]
|
||||
#[derive(ValueEnum, Clone, Copy, Debug, Eq, PartialEq)]
|
||||
pub enum InitHook {
|
||||
None,
|
||||
Prompt,
|
||||
Pwd,
|
||||
}
|
||||
|
||||
#[derive(ArgEnum, Clone, Debug)]
|
||||
#[derive(ValueEnum, Clone, Debug)]
|
||||
pub enum InitShell {
|
||||
Bash,
|
||||
Elvish,
|
||||
|
Loading…
Reference in New Issue
Block a user