mirror of
https://github.com/Llewellynvdm/zoxide.git
synced 2024-11-22 12:55:13 +00:00
Add cargo xtask test
This commit is contained in:
parent
a60a305279
commit
58313c67e7
18
CHANGELOG.md
18
CHANGELOG.md
@ -1,4 +1,4 @@
|
|||||||
<!-- markdownlint-disable MD024 -->
|
<!-- markdownlint-disable-file MD024 -->
|
||||||
|
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
@ -112,13 +112,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
- Aliases: `za`, `zq`, `zqi`, `zr`, `zri`. These are trivial aliases to zoxide that can easily be defined manually, and aren't very useful to most users.
|
- Aliases: `za`, `zq`, `zqi`, `zr`, `zri`. These are trivial aliases that can
|
||||||
|
easily be defined manually, and aren't very useful to most users.
|
||||||
|
|
||||||
## [0.5.0] - 2020-10-30
|
## [0.5.0] - 2020-10-30
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Inaccessible directories are no longer removed; zoxide can now remember paths on removable devices.
|
|
||||||
- `$_ZO_EXCLUDE_DIRS` now supports globs.
|
- `$_ZO_EXCLUDE_DIRS` now supports globs.
|
||||||
- `zoxide init` now defines `__zoxide_z*` functions that can be aliased as needed.
|
- `zoxide init` now defines `__zoxide_z*` functions that can be aliased as needed.
|
||||||
- Support for the [xonsh](https://xon.sh/) shell.
|
- Support for the [xonsh](https://xon.sh/) shell.
|
||||||
@ -135,6 +135,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
- Deprecated PWD hooks for POSIX shells.
|
- Deprecated PWD hooks for POSIX shells.
|
||||||
|
- Lazy deletion for inaccessible directories.
|
||||||
|
|
||||||
## [0.4.3] - 2020-07-04
|
## [0.4.3] - 2020-07-04
|
||||||
|
|
||||||
@ -153,7 +154,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Increased default value of `$_ZO_MAXAGE` to `10000`.
|
- Increased default value of `$_ZO_MAXAGE` to `10000`.
|
||||||
- Symlinks are treated as separate directories by default, this can be changed by setting `_ZO_RESOLVE_SYMLINKS=1`.
|
- Symlinks are treated as separate directories by default, this can be changed
|
||||||
|
by setting `_ZO_RESOLVE_SYMLINKS=1`.
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
@ -182,7 +184,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- `zoxide remove` now throws an error if there was no match in the database.
|
- `zoxide remove` now throws an error if there was no match in the database.
|
||||||
- Interactive mode in `zoxide` no longer throws an error if `fzf` exits gracefully.
|
- Interactive mode in `zoxide` no longer errors out if `fzf` exits gracefully.
|
||||||
- Canonicalize to regular paths instead of UNC paths on Windows.
|
- Canonicalize to regular paths instead of UNC paths on Windows.
|
||||||
- `zoxide init` now uses PWD hooks by default for better performance.
|
- `zoxide init` now uses PWD hooks by default for better performance.
|
||||||
- `$_ZO_ECHO` now only works when set to `1`.
|
- `$_ZO_ECHO` now only works when set to `1`.
|
||||||
@ -203,7 +205,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Query output no longer has the `query:` prefix, so `$(zq)` can now be used as an argument to commands.
|
- `zoxide query` output no longer has the `query:` prefix.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
@ -214,7 +216,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Automatic migration from `v0.2.x` databases.
|
- Automatic migration from `v0.2.x` databases.
|
||||||
- `$_ZO_EXCLUDE_DIRS` to prevent certain directories from being added to the database.
|
- `$_ZO_EXCLUDE_DIRS` to prevent directories from being added to the database.
|
||||||
- Support for POSIX-compliant shells.
|
- Support for POSIX-compliant shells.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
@ -225,7 +227,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Achieve thread safety using unique temporary database file names for each `zoxide` instance.
|
- Thread safety using unique tempfile names for each `zoxide` instance.
|
||||||
- Incomprehensive "could not allocate" message on database corruption.
|
- Incomprehensive "could not allocate" message on database corruption.
|
||||||
|
|
||||||
## [0.2.2] - 2020-03-20
|
## [0.2.2] - 2020-03-20
|
||||||
|
@ -1,4 +1,10 @@
|
|||||||
<!-- markdownlint-disable MD033 -->
|
<!-- markdownlint-configure-file {
|
||||||
|
"MD013": {
|
||||||
|
"code_blocks": false,
|
||||||
|
"tables": false
|
||||||
|
},
|
||||||
|
"MD033": false
|
||||||
|
} -->
|
||||||
|
|
||||||
# `zoxide`
|
# `zoxide`
|
||||||
|
|
||||||
|
20
shell.nix
20
shell.nix
@ -2,7 +2,6 @@ let
|
|||||||
rust = import (builtins.fetchTarball "https://github.com/oxalica/rust-overlay/archive/ad311f5bb5c5ef475985f1e0f264e831470a8510.tar.gz");
|
rust = import (builtins.fetchTarball "https://github.com/oxalica/rust-overlay/archive/ad311f5bb5c5ef475985f1e0f264e831470a8510.tar.gz");
|
||||||
pkgs = import <nixpkgs> { overlays = [ rust ]; };
|
pkgs = import <nixpkgs> { overlays = [ rust ]; };
|
||||||
pkgs-latest = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/b4692e4197869c42c46d77e31af7e687e1892f55.tar.gz") {};
|
pkgs-latest = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/b4692e4197869c42c46d77e31af7e687e1892f55.tar.gz") {};
|
||||||
pkgs-python = pkgs-latest.python3.withPackages (pkgs: [ pkgs.black pkgs.mypy pkgs.pylint ]);
|
|
||||||
in
|
in
|
||||||
pkgs.mkShell {
|
pkgs.mkShell {
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
@ -10,26 +9,29 @@ pkgs.mkShell {
|
|||||||
pkgs.rust-bin.stable.latest.default
|
pkgs.rust-bin.stable.latest.default
|
||||||
|
|
||||||
# Shells
|
# Shells
|
||||||
pkgs-latest.bash
|
|
||||||
pkgs-latest.dash
|
|
||||||
pkgs-latest.elvish
|
pkgs-latest.elvish
|
||||||
pkgs-latest.nushell
|
|
||||||
pkgs-latest.fish
|
pkgs-latest.fish
|
||||||
pkgs-latest.powershell
|
pkgs-latest.nushell
|
||||||
pkgs-latest.xonsh
|
pkgs-latest.xonsh
|
||||||
pkgs-latest.zsh
|
pkgs.bash
|
||||||
|
pkgs.dash
|
||||||
|
pkgs.powershell
|
||||||
|
pkgs.zsh
|
||||||
|
|
||||||
# Linters
|
# Linters
|
||||||
pkgs-latest.cargo-audit
|
pkgs-latest.cargo-audit
|
||||||
|
pkgs-latest.nodePackages.markdownlint-cli
|
||||||
|
pkgs-latest.python3Packages.black
|
||||||
|
pkgs-latest.python3Packages.mypy
|
||||||
|
pkgs-latest.python3Packages.pylint
|
||||||
pkgs-latest.shellcheck
|
pkgs-latest.shellcheck
|
||||||
pkgs-latest.shfmt
|
pkgs-latest.shfmt
|
||||||
pkgs-python
|
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
pkgs.cacert
|
pkgs.cacert
|
||||||
pkgs.libiconv
|
pkgs.libiconv
|
||||||
pkgs-latest.fzf
|
pkgs.fzf
|
||||||
pkgs-latest.git
|
pkgs.git
|
||||||
];
|
];
|
||||||
|
|
||||||
RUST_BACKTRACE = 1;
|
RUST_BACKTRACE = 1;
|
||||||
|
@ -28,17 +28,13 @@ function __zoxide_cd($dir) {
|
|||||||
# Hook to add new entries to the database.
|
# Hook to add new entries to the database.
|
||||||
function __zoxide_hook {
|
function __zoxide_hook {
|
||||||
$result = __zoxide_pwd
|
$result = __zoxide_pwd
|
||||||
if ($result -ne $null) {
|
if ($null -ne $result) {
|
||||||
zoxide add -- $result
|
zoxide add -- $result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Initialize hook.
|
# Initialize hook.
|
||||||
{# Initialize $__zoxide_hooked if it does not exist. Removing this will cause
|
if (-Not (Get-Command '__zoxide_hook' -ErrorAction SilentlyContinue)) {
|
||||||
# an unset variable error in StrictMode. #}
|
|
||||||
$__zoxide_hooked = (Get-Variable __zoxide_hooked -ValueOnly -ErrorAction SilentlyContinue)
|
|
||||||
if ($__zoxide_hooked -ne 1) {
|
|
||||||
$__zoxide_hooked = 1
|
|
||||||
{%- match hook %}
|
{%- match hook %}
|
||||||
{%- when InitHook::None %}
|
{%- when InitHook::None %}
|
||||||
{{ not_configured }}
|
{{ not_configured }}
|
||||||
@ -53,7 +49,8 @@ if ($__zoxide_hooked -ne 1) {
|
|||||||
$ExecutionContext.InvokeCommand.LocationChangedAction = {
|
$ExecutionContext.InvokeCommand.LocationChangedAction = {
|
||||||
$null = __zoxide_hook
|
$null = __zoxide_hook
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
Write-Error ("`n" +
|
Write-Error ("`n" +
|
||||||
"zoxide: PWD hooks are not supported below powershell 6.`n" +
|
"zoxide: PWD hooks are not supported below powershell 6.`n" +
|
||||||
" Use 'zoxide init powershell --hook prompt' instead.")
|
" Use 'zoxide init powershell --hook prompt' instead.")
|
||||||
@ -79,9 +76,10 @@ function __zoxide_z {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$result = __zoxide_pwd
|
$result = __zoxide_pwd
|
||||||
if ($result -ne $null) {
|
if ($null -ne $result) {
|
||||||
$result = zoxide query --exclude $result -- @args
|
$result = zoxide query --exclude $result -- @args
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$result = zoxide query -- @args
|
$result = zoxide query -- @args
|
||||||
}
|
}
|
||||||
if ($LASTEXITCODE -eq 0) {
|
if ($LASTEXITCODE -eq 0) {
|
||||||
|
@ -1,18 +1,19 @@
|
|||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
|
||||||
use clap::{ArgEnum, Clap};
|
use clap::Clap;
|
||||||
|
|
||||||
#[derive(Clap, Debug)]
|
#[derive(Clap, Debug)]
|
||||||
struct App {
|
struct App {
|
||||||
#[clap(arg_enum)]
|
#[clap(subcommand)]
|
||||||
task: Task,
|
task: Task,
|
||||||
#[clap(long)]
|
#[clap(long)]
|
||||||
nix: Option<bool>,
|
nix: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(ArgEnum, Debug)]
|
#[derive(Clap, Debug)]
|
||||||
enum Task {
|
enum Task {
|
||||||
CI,
|
CI,
|
||||||
|
Test { keywords: Vec<String> },
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(args: &[&str], nix: bool) {
|
fn run(args: &[&str], nix: bool) {
|
||||||
@ -32,17 +33,24 @@ fn run(args: &[&str], nix: bool) {
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let app = App::parse();
|
let app = App::parse();
|
||||||
let color = if std::env::var_os("CI").is_some() { "--color=always" } else { "--color=auto" };
|
|
||||||
let nix = app.nix.unwrap_or_else(|| Command::new("nix-shell").arg("--version").output().is_ok());
|
let nix = app.nix.unwrap_or_else(|| Command::new("nix-shell").arg("--version").output().is_ok());
|
||||||
let run = |args: &[&str]| run(args, nix);
|
let run = |args: &[&str]| run(args, nix);
|
||||||
match app.task {
|
match app.task {
|
||||||
Task::CI => {
|
Task::CI => {
|
||||||
|
let color = if std::env::var_os("CI").is_some() { "--color=always" } else { "" };
|
||||||
run(&["cargo", "fmt", "--", "--check", color, "--files-with-diff"]);
|
run(&["cargo", "fmt", "--", "--check", color, "--files-with-diff"]);
|
||||||
run(&["cargo", "check", "--all-features", color]);
|
run(&["cargo", "check", "--all-features", color]);
|
||||||
run(&["cargo", "clippy", "--all-features", color, "--", "--deny=warnings", "--deny=clippy::all"]);
|
run(&["cargo", "clippy", "--all-features", color, "--", "--deny=clippy::all", "--deny=warnings"]);
|
||||||
run(&["cargo", "test", if nix { "--all-features" } else { "" }, color, "--no-fail-fast"]);
|
run(&["cargo", "test", if nix { "--all-features" } else { "" }, color, "--no-fail-fast"]);
|
||||||
// color: https://github.com/rustsec/rustsec/pull/436
|
run(&["cargo", "audit", color, "--deny=warnings"]);
|
||||||
run(&["cargo", "audit", "--deny=warnings"]);
|
if nix {
|
||||||
|
run(&["markdownlint", "--ignore-path=.gitignore", "."]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Task::Test { keywords } => {
|
||||||
|
let mut args = vec!["cargo", "test", if nix { "--all-features" } else { "" }, "--no-fail-fast", "--"];
|
||||||
|
args.extend(keywords.iter().map(String::as_str));
|
||||||
|
run(&args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user