Release v0.7.0

This commit is contained in:
Ajeet D'Souza 2021-05-02 03:26:12 +05:30
parent fec064a1ef
commit a285b4e07d
8 changed files with 41 additions and 214 deletions

View File

@ -1,11 +1,11 @@
name: ci name: ci
on: on:
push: push:
branches: branches: [main]
- main
pull_request: pull_request:
jobs: jobs:
ci: ci:
name: ci-${{ matrix.os }}
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:

View File

@ -1,12 +1,10 @@
name: build name: release
on: on:
push: push:
branches: tags: ["v*"]
- main
pull_request:
jobs: jobs:
build: build:
name: build name: build-${{ matrix.target }}
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
@ -61,10 +59,10 @@ jobs:
tmpdir="zoxide-${{ matrix.target }}" tmpdir="zoxide-${{ matrix.target }}"
mkdir "$tmpdir/" mkdir "$tmpdir/"
cp -r {man,CHANGELOG.md,LICENSE,README.md} "$tmpdir/" cp -r {man,CHANGELOG.md,LICENSE,README.md} "$tmpdir/"
if [ "${{ matrix.target }}" = *"windows"* ]; then if [[ "${{ matrix.target }}" = *"windows"* ]]; then
asset="$tmpdir.zip" asset="$tmpdir.zip"
cp "target/${{ matrix.target }}/release/zoxide.exe" "$tmpdir/" cp "target/${{ matrix.target }}/release/zoxide.exe" "$tmpdir/"
7z a -mm=Deflate -mfb=258 -mpass=15 -r "$asset" "$tmpdir/" 7z a -mm=Deflate -mfb=258 -mpass=15 -r "$asset" "./$tmpdir/*"
else else
asset="$tmpdir.tar.gz" asset="$tmpdir.tar.gz"
cp "target/${{ matrix.target }}/release/zoxide" "$tmpdir/" cp "target/${{ matrix.target }}/release/zoxide" "$tmpdir/"
@ -77,7 +75,6 @@ jobs:
name: ${{ env.ASSET }} name: ${{ env.ASSET }}
path: ${{ env.ASSET }} path: ${{ env.ASSET }}
release: release:
if: ${{ startsWith(github.ref, 'refs/tags/') }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [build] needs: [build]
steps: steps:

View File

@ -5,7 +5,7 @@ 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/), 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). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased ## [0.7.0] - 2021-05-02
### Added ### Added
@ -17,12 +17,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `zoxide remove -i` now accepts multiple selections. - `zoxide remove -i` now accepts multiple selections.
- `zoxide add` no longer accepts zero parameters. - `zoxide add` no longer accepts zero parameters.
- `$_ZO_EXCLUDE_DIRS` now defaults to `"$HOME"`. - `$_ZO_EXCLUDE_DIRS` now defaults to `"$HOME"`.
- Binary releases now use `.zip` on Windows, `.tar.gz` otherwise.
### Fixed ### Fixed
- `cd -` on fish shells. - `cd -` on fish shells.
- `__zoxide_hook` no longer changes value of `$?` within `$PROMPT_COMMAND` on bash. - `__zoxide_hook` no longer changes value of `$?` within `$PROMPT_COMMAND` on bash.
### Removed
- GitHub install script.
## [0.6.0] - 2021-04-09 ## [0.6.0] - 2021-04-09
### Added ### Added
@ -220,6 +225,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- GitHub Actions pipeline to build and upload releases. - GitHub Actions pipeline to build and upload releases.
- Support for zsh. - Support for zsh.
[0.7.0]: https://github.com/ajeetdsouza/zoxide/compare/v0.6.0...v0.7.0
[0.6.0]: https://github.com/ajeetdsouza/zoxide/compare/v0.5.0...v0.6.0 [0.6.0]: https://github.com/ajeetdsouza/zoxide/compare/v0.5.0...v0.6.0
[0.5.0]: https://github.com/ajeetdsouza/zoxide/compare/v0.4.3...v0.5.0 [0.5.0]: https://github.com/ajeetdsouza/zoxide/compare/v0.4.3...v0.5.0
[0.4.3]: https://github.com/ajeetdsouza/zoxide/compare/v0.4.2...v0.4.3 [0.4.3]: https://github.com/ajeetdsouza/zoxide/compare/v0.4.2...v0.4.3

30
Cargo.lock generated
View File

@ -113,9 +113,9 @@ dependencies = [
[[package]] [[package]]
name = "bstr" name = "bstr"
version = "0.2.15" version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a40b47ad93e1a5404e6c18dec46b628214fee441c70f4ab5d6942142cc268a3d" checksum = "90682c8d613ad3373e66de8c6411e0ae2ab2571e879d2efbf73558cc66f21279"
dependencies = [ dependencies = [
"lazy_static", "lazy_static",
"memchr", "memchr",
@ -294,15 +294,15 @@ dependencies = [
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.93" version = "0.2.94"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9385f66bf6105b241aa65a61cb923ef20efc665cb9f9bb50ac2f0c4b7f378d41" checksum = "18794a8ad5b29321f790b55d93dfba91e125cb1a9edbd4f8e3150acc771c1a5e"
[[package]] [[package]]
name = "memchr" name = "memchr"
version = "2.3.4" version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc"
[[package]] [[package]]
name = "nom" name = "nom"
@ -355,9 +355,9 @@ checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857"
[[package]] [[package]]
name = "predicates" name = "predicates"
version = "1.0.7" 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 = "eeb433456c1a57cc93554dea3ce40b4c19c4057e41c55d4a0f3d84ea71c325aa" checksum = "f49cfaf7fdaa3bfacc6fa3e7054e65148878354a5cfddcf661df4c851f8021df"
dependencies = [ dependencies = [
"difference", "difference",
"predicates-core", "predicates-core",
@ -510,9 +510,9 @@ dependencies = [
[[package]] [[package]]
name = "redox_syscall" name = "redox_syscall"
version = "0.2.6" version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8270314b5ccceb518e7e578952f0b72b88222d02e8f77f5ecf7abbb673539041" checksum = "85dd92e586f7355c633911e11f77f3d12f04b1b1bd76a198bd34ae3af8341ef2"
dependencies = [ dependencies = [
"bitflags", "bitflags",
] ]
@ -591,9 +591,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.70" version = "1.0.71"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9505f307c872bab8eb46f77ae357c8eba1fdacead58ee5a850116b1d7f82883" checksum = "ad184cc9470f9117b2ac6817bfe297307418819ba40552f9b3846f05c33d5373"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -658,9 +658,9 @@ checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3"
[[package]] [[package]]
name = "unicode-xid" name = "unicode-xid"
version = "0.2.1" version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
[[package]] [[package]]
name = "vec_map" name = "vec_map"
@ -734,7 +734,7 @@ checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214"
[[package]] [[package]]
name = "zoxide" name = "zoxide"
version = "0.6.0" version = "0.7.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"askama", "askama",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "zoxide" name = "zoxide"
version = "0.6.0" version = "0.7.0"
authors = ["Ajeet D'Souza <98ajeet@gmail.com>"] authors = ["Ajeet D'Souza <98ajeet@gmail.com>"]
edition = "2018" edition = "2018"
description = "A smarter cd command" description = "A smarter cd command"

View File

@ -2,10 +2,6 @@ ifeq ($(CI), true)
ci_color_always := --color=always ci_color_always := --color=always
endif endif
ifeq ($(RELEASE), true)
build_flags := --release
endif
ifeq ($(OS), Windows_NT) ifeq ($(OS), Windows_NT)
NIX := false NIX := false
else else
@ -14,50 +10,30 @@ endif
.PHONY: build clean install test uninstall .PHONY: build clean install test uninstall
ifeq ($(NIX), true)
build: build:
nix-shell --pure --run 'cargo build $(build_flags) $(ci_color_always)' cargo build --release $(ci_color_always)
else
build:
cargo build $(build_flags) $(ci_color_always)
endif
ifeq ($(NIX), true)
clean:
nix-shell --pure --run 'cargo clean $(ci_color_always)'
else
clean: clean:
cargo clean $(ci_color_always) cargo clean $(ci_color_always)
endif
ifeq ($(NIX), true)
install:
nix-shell --pure --run 'cargo install --path=. $(ci_color_always)'
else
install: install:
cargo install --path=. $(ci_color_always) cargo install --path=. $(ci_color_always)
endif
ifeq ($(NIX), true) ifeq ($(NIX), true)
test: test:
nix-shell --pure --run 'cargo fmt -- --check --files-with-diff $(ci_color_always)' nix-shell --pure --run 'cargo fmt -- --check --files-with-diff $(ci_color_always)'
nix-shell --pure --run 'cargo check --all-features $(build_flags) $(ci_color_always)' nix-shell --pure --run 'cargo check --all-features --release $(ci_color_always)'
nix-shell --pure --run 'cargo clippy --all-features $(build_flags) $(ci_color_always) -- --deny warnings --deny clippy::all' nix-shell --pure --run 'cargo clippy --all-features --release $(ci_color_always) -- --deny warnings --deny clippy::all'
nix-shell --pure --run 'cargo test --all-features --no-fail-fast $(build_flags) $(ci_color_always)' nix-shell --pure --run 'cargo test --all-features --no-fail-fast --release $(ci_color_always)'
nix-shell --pure --run 'cargo audit --deny warnings $(ci_color_always) --ignore=RUSTSEC-2020-0095' nix-shell --pure --run 'cargo audit --deny warnings $(ci_color_always) --ignore=RUSTSEC-2020-0095'
else else
test: test:
cargo fmt -- --check --files-with-diff $(ci_color_always) cargo fmt -- --check --files-with-diff $(ci_color_always)
cargo check --all-features $(build_flags) $(ci_color_always) cargo check --all-features --release $(ci_color_always)
cargo clippy --all-features $(build_flags) $(ci_color_always) -- --deny warnings --deny clippy::all cargo clippy --all-features --release $(ci_color_always) -- --deny warnings --deny clippy::all
cargo test --no-fail-fast $(build_flags) $(ci_color_always) cargo test --no-fail-fast --release $(ci_color_always)
cargo audit --deny warnings $(ci_color_always) --ignore=RUSTSEC-2020-0095 cargo audit --deny warnings $(ci_color_always) --ignore=RUSTSEC-2020-0095
endif endif
ifeq ($(NIX), true)
uninstall:
nix-shell --pure --run 'cargo uninstall $(ci_color_always)'
else
uninstall: uninstall:
cargo uninstall $(ci_color_always) cargo uninstall $(ci_color_always)
endif

View File

@ -1,9 +1,9 @@
# `zoxide` # `zoxide`
[![crates.io][crates.io-badge]][crates.io]
> A smarter cd command > A smarter cd command
[![crates.io][crates.io-badge]][crates.io]
`zoxide` is a blazing fast replacement for your `cd` command, inspired by `zoxide` is a blazing fast replacement for your `cd` command, inspired by
[`z`][z] and [`z.lua`][z.lua]. It keeps track of the directories you use most [`z`][z] and [`z.lua`][z.lua]. It keeps track of the directories you use most
frequently, and uses a ranking algorithm to navigate to the best match. frequently, and uses a ranking algorithm to navigate to the best match.
@ -31,14 +31,8 @@ Read more about the matching algorithm [here][algorithm-matching].
### Step 1: Install `zoxide` ### Step 1: Install `zoxide`
`zoxide` works across all major platforms. If your distribution isn't included `zoxide` works across all major platforms. If your distribution isn't included
in the list below, you can directly install the binary from GitHub: in the list below, you can download the binary from the [Releases] page and
copy it to your `$PATH`.
```sh
curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | sh
```
If you would rather not run a script, you can download the binary from the
[Releases] page and add it to your `$PATH`.
#### On Linux #### On Linux

View File

@ -1,146 +0,0 @@
#!/bin/sh
set -u
usage() {
cat 1>&2 <<EOF
The installer for zoxide
USAGE
zoxide-install
EOF
}
main() {
need_cmd uname
need_cmd curl
need_cmd grep
need_cmd cut
need_cmd xargs
need_cmd chmod
install
}
install() {
local _ostype _cputype _clibtype _target _cargobuild _install_path
_ostype="$(uname -s)"
_cputype="$(uname -m)"
_cargobuild="no"
_install_path="/usr/local/bin"
case $_cputype in
x86_64 | x86-64 | amd64)
_cputype="x86_64"
_clibtype="musl"
;;
armv7 | aarch64)
_clibtype="musl"
;;
*)
warning "No binaries are available for your CPU architecture ($_cputype)"
_clibtype="gnu"
_cargobuild="yes"
;;
esac
case $_ostype in
Linux)
_ostype=unknown-linux-$_clibtype
;;
Darwin)
_ostype=apple-darwin
;;
*)
warning "No binaries are available for your operating system ($_ostype)"
_cargobuild="yes"
;;
esac
if [ $_cargobuild = "yes" ]; then
cargo_build
exit 0
fi
_target="$_cputype-$_ostype"
warning "Detected target: $_target"
success "Downloading zoxide..."
## Downloading the binaries
ensure rm -rf "zoxide-$_target"
curl -s https://api.github.com/repos/ajeetdsouza/zoxide/releases/latest | grep "browser_download_url" | cut -d '"' -f 4 | grep "$_target" | xargs -n 1 curl -LJO
ensure mv "zoxide-$_target" "zoxide_bin"
ensure sudo mv zoxide_bin "$_install_path/zoxide"
ensure chmod +x "$_install_path/zoxide"
success "zoxide is installed!"
info "Please ensure that $_install_path is added to your \$PATH."
}
success() {
printf "\033[32m%s\033[0m\n" "$1" >&1
}
info() {
printf "%s\n" "$1" >&1
}
warning() {
printf "\033[33m%s\033[0m\n" "$1" >&2
}
error() {
printf "\033[31;1m%s\033[0m\n" "$1" >&2
exit 1
}
cmd_chk() {
command -v "$1" >/dev/null 2>&1
}
## Ensures that the command executes without error
ensure() {
if ! "$@"; then error "command failed: $*"; fi
}
need_cmd() {
if ! cmd_chk "$1"; then
error "need $1 (command not found)"
fi
}
prompt_confirm() {
if [ ! -t 1 ]; then
error "Unable to run interactively. Please execute this script using interactive shell"
fi
while true; do
read -rp "Is this okay? (y/N): " _choice
_choice=$(echo "$_choice" | tr '[:upper:]' '[:lower:]')
case "$_choice" in
y | yes) break ;;
n | no) error "Operation aborted" ;;
esac
done
}
cargo_build() {
success "Compiling from source..."
if ! cmd_chk "cargo"; then
success "Cargo will be installed."
prompt_confirm
ensure curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# shellcheck source=/dev/null
. "$HOME/.cargo/env"
fi
RUSTFLAGS="-C target-cpu=native" ensure cargo install zoxide
}
main "$@" || exit 1