diff --git a/CHANGELOG.md b/CHANGELOG.md index 85442b7..6fa8b10 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Fixed + +- Fix compile errors due to broken `clap` dependency. + ## [0.7.7] - 2021-10-15 ### Fixed diff --git a/Cargo.lock b/Cargo.lock index 7f68f29..8ea8f77 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -141,9 +141,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "3.0.0-beta.4" +version = "3.0.0-beta.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcd70aa5597dbc42f7217a543f9ef2768b2ef823ba29036072d30e1d88e98406" +checksum = "feff3878564edb93745d58cf63e17b63f24142506e7a20c87a5521ed7bfb1d63" dependencies = [ "atty", "bitflags", @@ -154,14 +154,14 @@ dependencies = [ "strsim", "termcolor", "textwrap", - "vec_map", + "unicase", ] [[package]] name = "clap_derive" -version = "3.0.0-beta.4" +version = "3.0.0-beta.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b5bb0d655624a0b8770d1c178fb8ffcb1f91cc722cb08f451e3dc72465421ac" +checksum = "8b15c6b4f786ffb6192ffe65a36855bc1fc2444bcd0945ae16748dcd6ed7d0d3" dependencies = [ "heck", "proc-macro-error", @@ -172,9 +172,9 @@ dependencies = [ [[package]] name = "clap_generate" -version = "3.0.0-beta.4" +version = "3.0.0-beta.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d9b1abef93569f290952eff3c4a0a92d6767bb5158db095b4dc9a512b1c3643" +checksum = "097ab5db1c3417442270cd57c8dd39f6c3114d3ce09d595f9efddbb1fcfaa799" dependencies = [ "clap", ] @@ -358,9 +358,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.103" +version = "0.2.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8f7255a17a627354f321ef0055d63b898c6fb27eff628af4d1b66b7331edf6" +checksum = "7b2f96d100e1cf1929e7719b7edb3b90ab5298072638fccd77be9ce942ecdfce" [[package]] name = "log" @@ -416,15 +416,18 @@ dependencies = [ [[package]] name = "os_str_bytes" -version = "3.1.0" +version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6acbef58a60fe69ab50510a55bc8cdd4d6cf2283d27ad338f54cb52747a9cf2d" +checksum = "addaa943333a514159c80c97ff4a93306530d965d27e139188283cd13e06a799" +dependencies = [ + "memchr", +] [[package]] name = "ppv-lite86" -version = "0.2.10" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" +checksum = "c3ca011bd0129ff4ae15cd04c4eef202cadf6c51c21e47aba319b4e0501db741" [[package]] name = "predicates" @@ -737,6 +740,15 @@ dependencies = [ "once_cell", ] +[[package]] +name = "unicase" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" +dependencies = [ + "version_check", +] + [[package]] name = "unicode-segmentation" version = "1.8.0" @@ -755,12 +767,6 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - [[package]] name = "version_check" version = "0.9.3" diff --git a/Cargo.toml b/Cargo.toml index 837b04e..c9292bc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,7 @@ members = ["xtask/"] anyhow = "1.0.32" askama = { version = "0.10.3", default-features = false } bincode = "1.3.1" -clap = "=3.0.0-beta.4" +clap = "=3.0.0-beta.5" dirs-next = "2.0.0" dunce = "1.0.1" glob = "0.3.0" @@ -34,8 +34,8 @@ rand = { version = "0.8.4", features = [ ], default-features = false } [build-dependencies] -clap = "=3.0.0-beta.4" -clap_generate = "=3.0.0-beta.4" +clap = "=3.0.0-beta.5" +clap_generate = "=3.0.0-beta.5" [dev-dependencies] assert_cmd = "2.0.0" diff --git a/README.md b/README.md index 3c4d0a5..2fcf469 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ Alternatively, you can use a package manager: | Distribution | Repository | Instructions | | ------------------ | ----------------------- | ---------------------------------------------------------------------------------------------- | -| ***Any*** | **[crates.io]** | `cargo install zoxide` | +| ***Any*** | **[crates.io]** | `cargo install zoxide --locked` | | *Any* | [conda-forge] | `conda install -c conda-forge zoxide` | | *Any* | [Linuxbrew] | `brew install zoxide` | | Alpine Linux 3.13+ | [Alpine Linux Packages] | `apk add zoxide` | @@ -82,7 +82,7 @@ To install `zoxide`, use a package manager: | Repository | Instructions | | --------------- | ------------------------------------- | -| **[crates.io]** | `cargo install zoxide` | +| **[crates.io]** | `cargo install zoxide --locked` | | [conda-forge] | `conda install -c conda-forge zoxide` | | [Homebrew] | `brew install zoxide` | | [MacPorts] | `port install zoxide` | @@ -102,7 +102,7 @@ Alternatively, you can use a package manager: | Repository | Instructions | | --------------- | ------------------------------------- | -| **[crates.io]** | `cargo install zoxide` | +| **[crates.io]** | `cargo install zoxide --locked` | | [Chocolatey] | `choco install zoxide` | | [conda-forge] | `conda install -c conda-forge zoxide` | | [Scoop] | `scoop install zoxide` | @@ -114,12 +114,12 @@ Alternatively, you can use a package manager: To install `zoxide`, use a package manager: -| Distribution | Repository | Instructions | -| ------------- | --------------- | ---------------------- | -| ***Any*** | **[crates.io]** | `cargo install zoxide` | -| DragonFly BSD | [DPorts] | `pkg install zoxide` | -| FreeBSD | [FreshPorts] | `pkg install zoxide` | -| NetBSD | [pkgsrc] | `pkgin install zoxide` | +| Distribution | Repository | Instructions | +| ------------- | --------------- | ------------------------------- | +| ***Any*** | **[crates.io]** | `cargo install zoxide --locked` | +| DragonFly BSD | [DPorts] | `pkg install zoxide` | +| FreeBSD | [FreshPorts] | `pkg install zoxide` | +| NetBSD | [pkgsrc] | `pkgin install zoxide` | diff --git a/build.rs b/build.rs index 8d173de..60434f8 100644 --- a/build.rs +++ b/build.rs @@ -22,7 +22,7 @@ fn main() { fn git_version() -> Option { let dir = env!("CARGO_MANIFEST_DIR"); let mut git = Command::new("git"); - git.args(&["-C", &dir, "describe", "--tags", "--broken"]); + git.args(&["-C", dir, "describe", "--tags", "--broken"]); let output = git.output().ok()?; if !output.status.success() || output.stdout.is_empty() || !output.stderr.is_empty() { @@ -44,11 +44,11 @@ fn generate_completions() -> io::Result<()> { let bin_name = env!("CARGO_PKG_NAME"); let out_dir = "contrib/completions"; - generate_to::(app, bin_name, out_dir)?; - generate_to::(app, bin_name, out_dir)?; - generate_to::(app, bin_name, out_dir)?; - generate_to::(app, bin_name, out_dir)?; - generate_to::(app, bin_name, out_dir)?; + generate_to(Bash, app, bin_name, out_dir)?; + generate_to(Elvish, app, bin_name, out_dir)?; + generate_to(Fish, app, bin_name, out_dir)?; + generate_to(PowerShell, app, bin_name, out_dir)?; + generate_to(Zsh, app, bin_name, out_dir)?; Ok(()) } diff --git a/contrib/completions/_zoxide b/contrib/completions/_zoxide index db6efb1..178a27d 100644 --- a/contrib/completions/_zoxide +++ b/contrib/completions/_zoxide @@ -39,7 +39,7 @@ _arguments "${_arguments_options[@]}" \ ;; (import) _arguments "${_arguments_options[@]}" \ -'--from=[Application to import from]: :(autojump z)' \ +'--from=[Application to import from]:FROM:(autojump z)' \ '--merge[Merge into existing database]' \ '-h[Print help information]' \ '--help[Print help information]' \ @@ -50,8 +50,8 @@ _arguments "${_arguments_options[@]}" \ ;; (init) _arguments "${_arguments_options[@]}" \ -'--cmd=[Renames the '\''z'\'' command and corresponding aliases]' \ -'--hook=[Chooses event upon which an entry is added to the database]: :(none prompt pwd)' \ +'--cmd=[Renames the '\''z'\'' command and corresponding aliases]:CMD: ' \ +'--hook=[Chooses event upon which an entry is added to the database]:HOOK:(none prompt pwd)' \ '--no-aliases[Prevents zoxide from defining any commands]' \ '-h[Print help information]' \ '--help[Print help information]' \ @@ -62,7 +62,7 @@ _arguments "${_arguments_options[@]}" \ ;; (query) _arguments "${_arguments_options[@]}" \ -'--exclude=[Exclude a path from results]: :_files -/' \ +'--exclude=[Exclude a path from results]:path:_files -/' \ '--all[Show deleted directories]' \ '(-l --list)-i[Use interactive selection]' \ '(-l --list)--interactive[Use interactive selection]' \ @@ -79,8 +79,8 @@ _arguments "${_arguments_options[@]}" \ ;; (remove) _arguments "${_arguments_options[@]}" \ -'()*-i+[]' \ -'()*--interactive=[]' \ +'()-i+[]:keywords: ' \ +'()--interactive=[]:keywords: ' \ '-h[Print help information]' \ '--help[Print help information]' \ '-V[Print version information]' \ diff --git a/contrib/completions/zoxide.bash b/contrib/completions/zoxide.bash index 8976dba..6b4060e 100644 --- a/contrib/completions/zoxide.bash +++ b/contrib/completions/zoxide.bash @@ -12,7 +12,6 @@ _zoxide() { zoxide) cmd="zoxide" ;; - add) cmd+="__add" ;; @@ -35,13 +34,12 @@ _zoxide() { case "${cmd}" in zoxide) - opts=" -h -V --help --version add import init query remove" + opts="-h -V --help --version add import init query remove" if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in - *) COMPREPLY=() ;; @@ -49,15 +47,13 @@ _zoxide() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - zoxide__add) - opts=" -h -V --help --version ... " + opts="-h -V --help --version ..." if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in - *) COMPREPLY=() ;; @@ -66,13 +62,12 @@ _zoxide() { return 0 ;; zoxide__import) - opts=" -h -V --from --merge --help --version " + opts="-h -V --from --merge --help --version " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in - --from) COMPREPLY=($(compgen -W "autojump z" -- "${cur}")) return 0 @@ -85,13 +80,12 @@ _zoxide() { return 0 ;; zoxide__init) - opts=" -h -V --no-aliases --cmd --hook --help --version " + opts="-h -V --no-aliases --cmd --hook --help --version bash elvish fish nushell posix powershell xonsh zsh" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in - --cmd) COMPREPLY=($(compgen -f "${cur}")) return 0 @@ -108,13 +102,12 @@ _zoxide() { return 0 ;; zoxide__query) - opts=" -i -l -s -h -V --all --interactive --list --score --exclude --help --version ... " + opts="-i -l -s -h -V --all --interactive --list --score --exclude --help --version ..." if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in - --exclude) COMPREPLY=($(compgen -f "${cur}")) return 0 @@ -127,13 +120,12 @@ _zoxide() { return 0 ;; zoxide__remove) - opts=" -i -h -V --interactive --help --version ... " + opts="-i -h -V --interactive --help --version ..." if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in - --interactive) COMPREPLY=($(compgen -f "${cur}")) return 0 diff --git a/contrib/completions/zoxide.elv b/contrib/completions/zoxide.elv index e6bf477..dfdebc2 100644 --- a/contrib/completions/zoxide.elv +++ b/contrib/completions/zoxide.elv @@ -2,21 +2,21 @@ use builtin; use str; -edit:completion:arg-completer[zoxide] = [@words]{ +set edit:completion:arg-completer[zoxide] = [@words]{ fn spaces [n]{ builtin:repeat $n ' ' | str:join '' } fn cand [text desc]{ - edit:complex-candidate $text &display-suffix=' '(spaces (- 14 (wcswidth $text)))$desc + edit:complex-candidate $text &display=$text' '(spaces (- 14 (wcswidth $text)))$desc } - command = 'zoxide' + var command = 'zoxide' for word $words[1..-1] { if (str:has-prefix $word '-') { break } - command = $command';'$word + set command = $command';'$word } - completions = [ + var completions = [ &'zoxide'= { cand -h 'Print help information' cand --help 'Print help information' diff --git a/contrib/completions/zoxide.fish b/contrib/completions/zoxide.fish index a339ff3..1ca8db0 100644 --- a/contrib/completions/zoxide.fish +++ b/contrib/completions/zoxide.fish @@ -5,21 +5,17 @@ complete -c zoxide -n "__fish_use_subcommand" -f -a "import" -d 'Import entries complete -c zoxide -n "__fish_use_subcommand" -f -a "init" -d 'Generate shell configuration' complete -c zoxide -n "__fish_use_subcommand" -f -a "query" -d 'Search for a directory in the database' complete -c zoxide -n "__fish_use_subcommand" -f -a "remove" -d 'Remove a directory from the database' -complete -c zoxide -n "__fish_seen_subcommand_from add" -r -f -a "(__fish_complete_directories)" complete -c zoxide -n "__fish_seen_subcommand_from add" -s h -l help -d 'Print help information' complete -c zoxide -n "__fish_seen_subcommand_from add" -s V -l version -d 'Print version information' -complete -c zoxide -n "__fish_seen_subcommand_from import" -r -F -complete -c zoxide -n "__fish_seen_subcommand_from import" -l from -d 'Application to import from' -r -f -a "autojump z" +complete -c zoxide -n "__fish_seen_subcommand_from import" -l from -d 'Application to import from' -r -f -a "{autojump ,z }" complete -c zoxide -n "__fish_seen_subcommand_from import" -l merge -d 'Merge into existing database' complete -c zoxide -n "__fish_seen_subcommand_from import" -s h -l help -d 'Print help information' complete -c zoxide -n "__fish_seen_subcommand_from import" -s V -l version -d 'Print version information' -complete -c zoxide -n "__fish_seen_subcommand_from init" -r -f -a "bash elvish fish nushell posix powershell xonsh zsh" complete -c zoxide -n "__fish_seen_subcommand_from init" -l cmd -d 'Renames the \'z\' command and corresponding aliases' -r -complete -c zoxide -n "__fish_seen_subcommand_from init" -l hook -d 'Chooses event upon which an entry is added to the database' -r -f -a "none prompt pwd" +complete -c zoxide -n "__fish_seen_subcommand_from init" -l hook -d 'Chooses event upon which an entry is added to the database' -r -f -a "{none ,prompt ,pwd }" complete -c zoxide -n "__fish_seen_subcommand_from init" -l no-aliases -d 'Prevents zoxide from defining any commands' complete -c zoxide -n "__fish_seen_subcommand_from init" -s h -l help -d 'Print help information' complete -c zoxide -n "__fish_seen_subcommand_from init" -s V -l version -d 'Print version information' -complete -c zoxide -n "__fish_seen_subcommand_from query" -r complete -c zoxide -n "__fish_seen_subcommand_from query" -l exclude -d 'Exclude a path from results' -r -f -a "(__fish_complete_directories)" complete -c zoxide -n "__fish_seen_subcommand_from query" -l all -d 'Show deleted directories' complete -c zoxide -n "__fish_seen_subcommand_from query" -s i -l interactive -d 'Use interactive selection' @@ -28,6 +24,5 @@ complete -c zoxide -n "__fish_seen_subcommand_from query" -s s -l score -d 'Prin complete -c zoxide -n "__fish_seen_subcommand_from query" -s h -l help -d 'Print help information' complete -c zoxide -n "__fish_seen_subcommand_from query" -s V -l version -d 'Print version information' complete -c zoxide -n "__fish_seen_subcommand_from remove" -s i -l interactive -r -complete -c zoxide -n "__fish_seen_subcommand_from remove" -r -f -a "(__fish_complete_directories)" complete -c zoxide -n "__fish_seen_subcommand_from remove" -s h -l help -d 'Print help information' complete -c zoxide -n "__fish_seen_subcommand_from remove" -s V -l version -d 'Print version information' diff --git a/shell.nix b/shell.nix index 2b081fc..4b2edcd 100644 --- a/shell.nix +++ b/shell.nix @@ -3,7 +3,7 @@ let "https://github.com/oxalica/rust-overlay/archive/ad311f5bb5c5ef475985f1e0f264e831470a8510.tar.gz"); pkgs = import { overlays = [ rust ]; }; pkgs-latest = import (fetchTarball - "https://github.com/NixOS/nixpkgs/archive/b4692e4197869c42c46d77e31af7e687e1892f55.tar.gz") + "https://github.com/NixOS/nixpkgs/archive/3ef1d2a9602c18f8742e1fb63d5ae9867092e3d6.tar.gz") { }; in pkgs.mkShell { buildInputs = [ diff --git a/src/app/_app.rs b/src/app/_app.rs index 8e9baba..ec33a91 100644 --- a/src/app/_app.rs +++ b/src/app/_app.rs @@ -1,6 +1,6 @@ use std::path::PathBuf; -use clap::{AppSettings, ArgEnum, Clap, ValueHint}; +use clap::{AppSettings, ArgEnum, Parser, ValueHint}; const ENV_HELP: &str = "ENVIRONMENT VARIABLES: _ZO_DATA_DIR Path for zoxide data files @@ -10,15 +10,13 @@ const ENV_HELP: &str = "ENVIRONMENT VARIABLES: _ZO_MAXAGE Maximum total age after which entries start getting deleted _ZO_RESOLVE_SYMLINKS Resolve symlinks when storing paths"; -#[derive(Clap, Debug)] +#[derive(Debug, Parser)] #[clap( bin_name = env!("CARGO_PKG_NAME"), about, author, after_help = ENV_HELP, - global_setting(AppSettings::ColoredHelp), global_setting(AppSettings::DisableHelpSubcommand), - global_setting(AppSettings::DisableVersionForSubcommands), global_setting(AppSettings::PropagateVersion), version = option_env!("ZOXIDE_VERSION").unwrap_or_default() )] @@ -31,14 +29,14 @@ pub enum App { } /// Add a new directory or increment its rank -#[derive(Clap, Debug)] +#[derive(Debug, Parser)] pub struct Add { #[clap(min_values = 1, required = true, value_hint = ValueHint::DirPath)] pub paths: Vec, } /// Import entries from another application -#[derive(Clap, Debug)] +#[derive(Debug, Parser)] pub struct Import { #[clap(value_hint = ValueHint::FilePath)] pub path: PathBuf, @@ -52,14 +50,14 @@ pub struct Import { pub merge: bool, } -#[derive(ArgEnum, Debug)] +#[derive(ArgEnum, Clone, Debug)] pub enum ImportFrom { Autojump, Z, } /// Generate shell configuration -#[derive(Clap, Debug)] +#[derive(Debug, Parser)] pub struct Init { #[clap(arg_enum)] pub shell: InitShell, @@ -84,7 +82,7 @@ pub enum InitHook { Pwd, } -#[derive(ArgEnum, Debug)] +#[derive(ArgEnum, Clone, Debug)] pub enum InitShell { Bash, Elvish, @@ -97,7 +95,7 @@ pub enum InitShell { } /// Search for a directory in the database -#[derive(Clap, Debug)] +#[derive(Debug, Parser)] pub struct Query { pub keywords: Vec, @@ -123,7 +121,7 @@ pub struct Query { } /// Remove a directory from the database -#[derive(Clap, Debug)] +#[derive(Debug, Parser)] pub struct Remove { // Use interactive selection #[clap(conflicts_with = "paths", long, short, value_name = "keywords")] diff --git a/src/main.rs b/src/main.rs index cd7b33c..c9584e4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,7 +9,7 @@ mod util; use std::io::{self, Write}; use std::{env, process}; -use clap::Clap; +use clap::Parser; use crate::app::{App, Run}; use crate::error::SilentExit; diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml index 6852340..2a999ce 100644 --- a/xtask/Cargo.toml +++ b/xtask/Cargo.toml @@ -6,6 +6,6 @@ publish = false [dependencies] anyhow = "1.0.32" -clap = "=3.0.0-beta.4" +clap = "=3.0.0-beta.5" ignore = "0.4.18" shell-words = "1.0.0" diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 6de70d4..fd983d9 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -1,5 +1,5 @@ use anyhow::{bail, Context, Result}; -use clap::Clap; +use clap::Parser; use ignore::Walk; use std::env; @@ -25,7 +25,7 @@ fn main() -> Result<()> { Ok(()) } -#[derive(Clap)] +#[derive(Parser)] enum App { CI, Fmt {