diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b3598fa..9b3d8e7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,11 +1,11 @@ name: ci on: push: - branches: - - main + branches: [main] pull_request: jobs: ci: + name: ci-${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: matrix: diff --git a/.github/workflows/build.yml b/.github/workflows/release.yml similarity index 91% rename from .github/workflows/build.yml rename to .github/workflows/release.yml index fabc89d..07a0dcf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/release.yml @@ -1,12 +1,10 @@ -name: build +name: release on: push: - branches: - - main - pull_request: + tags: ["v*"] jobs: build: - name: build + name: build-${{ matrix.target }} runs-on: ${{ matrix.os }} strategy: matrix: @@ -61,10 +59,10 @@ jobs: tmpdir="zoxide-${{ matrix.target }}" mkdir "$tmpdir/" cp -r {man,CHANGELOG.md,LICENSE,README.md} "$tmpdir/" - if [ "${{ matrix.target }}" = *"windows"* ]; then + if [[ "${{ matrix.target }}" = *"windows"* ]]; then asset="$tmpdir.zip" 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 asset="$tmpdir.tar.gz" cp "target/${{ matrix.target }}/release/zoxide" "$tmpdir/" @@ -77,7 +75,6 @@ jobs: name: ${{ env.ASSET }} path: ${{ env.ASSET }} release: - if: ${{ startsWith(github.ref, 'refs/tags/') }} runs-on: ubuntu-latest needs: [build] steps: diff --git a/CHANGELOG.md b/CHANGELOG.md index 22b5b01..610ac08 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## Unreleased +## [0.7.0] - 2021-05-02 ### 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 add` no longer accepts zero parameters. - `$_ZO_EXCLUDE_DIRS` now defaults to `"$HOME"`. +- Binary releases now use `.zip` on Windows, `.tar.gz` otherwise. ### Fixed - `cd -` on fish shells. - `__zoxide_hook` no longer changes value of `$?` within `$PROMPT_COMMAND` on bash. +### Removed + +- GitHub install script. + ## [0.6.0] - 2021-04-09 ### 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. - 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.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 diff --git a/Cargo.lock b/Cargo.lock index 06a2451..c947d55 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -113,9 +113,9 @@ dependencies = [ [[package]] name = "bstr" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a40b47ad93e1a5404e6c18dec46b628214fee441c70f4ab5d6942142cc268a3d" +checksum = "90682c8d613ad3373e66de8c6411e0ae2ab2571e879d2efbf73558cc66f21279" dependencies = [ "lazy_static", "memchr", @@ -294,15 +294,15 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.93" +version = "0.2.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9385f66bf6105b241aa65a61cb923ef20efc665cb9f9bb50ac2f0c4b7f378d41" +checksum = "18794a8ad5b29321f790b55d93dfba91e125cb1a9edbd4f8e3150acc771c1a5e" [[package]] name = "memchr" -version = "2.3.4" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" +checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc" [[package]] name = "nom" @@ -355,9 +355,9 @@ checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" [[package]] name = "predicates" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eeb433456c1a57cc93554dea3ce40b4c19c4057e41c55d4a0f3d84ea71c325aa" +checksum = "f49cfaf7fdaa3bfacc6fa3e7054e65148878354a5cfddcf661df4c851f8021df" dependencies = [ "difference", "predicates-core", @@ -510,9 +510,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8270314b5ccceb518e7e578952f0b72b88222d02e8f77f5ecf7abbb673539041" +checksum = "85dd92e586f7355c633911e11f77f3d12f04b1b1bd76a198bd34ae3af8341ef2" dependencies = [ "bitflags", ] @@ -591,9 +591,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "syn" -version = "1.0.70" +version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9505f307c872bab8eb46f77ae357c8eba1fdacead58ee5a850116b1d7f82883" +checksum = "ad184cc9470f9117b2ac6817bfe297307418819ba40552f9b3846f05c33d5373" dependencies = [ "proc-macro2", "quote", @@ -658,9 +658,9 @@ checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" [[package]] name = "unicode-xid" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" +checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" [[package]] name = "vec_map" @@ -734,7 +734,7 @@ checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214" [[package]] name = "zoxide" -version = "0.6.0" +version = "0.7.0" dependencies = [ "anyhow", "askama", diff --git a/Cargo.toml b/Cargo.toml index 9fc26ae..198640b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "zoxide" -version = "0.6.0" +version = "0.7.0" authors = ["Ajeet D'Souza <98ajeet@gmail.com>"] edition = "2018" description = "A smarter cd command" diff --git a/Makefile b/Makefile index ff63650..e600c1e 100644 --- a/Makefile +++ b/Makefile @@ -2,10 +2,6 @@ ifeq ($(CI), true) ci_color_always := --color=always endif -ifeq ($(RELEASE), true) - build_flags := --release -endif - ifeq ($(OS), Windows_NT) NIX := false else @@ -14,50 +10,30 @@ endif .PHONY: build clean install test uninstall -ifeq ($(NIX), true) build: - nix-shell --pure --run 'cargo build $(build_flags) $(ci_color_always)' -else -build: - cargo build $(build_flags) $(ci_color_always) -endif + cargo build --release $(ci_color_always) -ifeq ($(NIX), true) -clean: - nix-shell --pure --run 'cargo clean $(ci_color_always)' -else clean: cargo clean $(ci_color_always) -endif -ifeq ($(NIX), true) -install: - nix-shell --pure --run 'cargo install --path=. $(ci_color_always)' -else install: cargo install --path=. $(ci_color_always) -endif ifeq ($(NIX), true) test: 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 clippy --all-features $(build_flags) $(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 check --all-features --release $(ci_color_always)' + 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 --release $(ci_color_always)' nix-shell --pure --run 'cargo audit --deny warnings $(ci_color_always) --ignore=RUSTSEC-2020-0095' else test: cargo fmt -- --check --files-with-diff $(ci_color_always) - cargo check --all-features $(build_flags) $(ci_color_always) - cargo clippy --all-features $(build_flags) $(ci_color_always) -- --deny warnings --deny clippy::all - cargo test --no-fail-fast $(build_flags) $(ci_color_always) + cargo check --all-features --release $(ci_color_always) + cargo clippy --all-features --release $(ci_color_always) -- --deny warnings --deny clippy::all + cargo test --no-fail-fast --release $(ci_color_always) cargo audit --deny warnings $(ci_color_always) --ignore=RUSTSEC-2020-0095 endif -ifeq ($(NIX), true) -uninstall: - nix-shell --pure --run 'cargo uninstall $(ci_color_always)' -else uninstall: cargo uninstall $(ci_color_always) -endif diff --git a/README.md b/README.md index 8396814..bb246bb 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # `zoxide` -[![crates.io][crates.io-badge]][crates.io] - > A smarter cd command +[![crates.io][crates.io-badge]][crates.io] + `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 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` `zoxide` works across all major platforms. If your distribution isn't included -in the list below, you can directly install the binary from GitHub: - -```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`. +in the list below, you can download the binary from the [Releases] page and +copy it to your `$PATH`. #### On Linux diff --git a/install.sh b/install.sh deleted file mode 100755 index 46f7054..0000000 --- a/install.sh +++ /dev/null @@ -1,146 +0,0 @@ -#!/bin/sh - -set -u - -usage() { - cat 1>&2 <&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