diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 66244c5909..3ef28505e9 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -16,6 +16,7 @@ jobs: target: - aarch64-apple-darwin - aarch64-unknown-linux-musl + - arm-unknown-linux-musleabihf - armv7-unknown-linux-musleabihf - x86_64-apple-darwin - x86_64-pc-windows-msvc @@ -27,6 +28,9 @@ jobs: - target: aarch64-unknown-linux-musl os: ubuntu-latest target_rustflags: '--codegen linker=aarch64-linux-gnu-gcc' + - target: arm-unknown-linux-musleabihf + os: ubuntu-latest + target_rustflags: '--codegen linker=arm-linux-gnueabihf-gcc' - target: armv7-unknown-linux-musleabihf os: ubuntu-latest target_rustflags: '--codegen linker=arm-linux-gnueabihf-gcc' @@ -58,8 +62,8 @@ jobs: sudo apt-get update sudo apt-get install gcc-aarch64-linux-gnu - - name: Install ARM7 Toolchain - if: ${{ matrix.target == 'armv7-unknown-linux-musleabihf' }} + - name: Install ARM Toolchain + if: ${{ matrix.target == 'arm-unknown-linux-musleabihf' || matrix.target == 'armv7-unknown-linux-musleabihf' }} run: | sudo apt-get update sudo apt-get install gcc-arm-linux-gnueabihf diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d72f7663e..e40d6d8618 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,28 @@ Changelog ========= +[1.16.0](https://github.com/casey/just/releases/tag/1.16.0) - 2023-11-08 +------------------------------------------------------------------------ + +### Added +- Add ARMv6 release target ([#1715](https://github.com/casey/just/pull/1715) by [ragazenta](https://github.com/ragazenta)) +- Add `semver_matches` function ([#1713](https://github.com/casey/just/pull/1713) by [t3hmrman](https://github.com/t3hmrman)) +- Add `dotenv-filename` and `dotenv-path` settings ([#1692](https://github.com/casey/just/pull/1692) by [ltfourrier](https://github.com/ltfourrier)) +- Allow setting echoed recipe line color ([#1670](https://github.com/casey/just/pull/1670) by [avi-cenna](https://github.com/avi-cenna)) + +### Fixed +- Fix Fish completion script ([#1710](https://github.com/casey/just/pull/1710) by [l4zygreed](https://github.com/l4zygreed)) + +### Misc +- Fix readme typo ([#1717](https://github.com/casey/just/pull/1717) by [barraponto](https://github.com/barraponto)) +- Clean up error display ([#1699](https://github.com/casey/just/pull/1699) by [nyurik](https://github.com/nyurik)) +- Misc fixes ([#1700](https://github.com/casey/just/pull/1700) by [nyurik](https://github.com/nyurik)) +- Fix readme build badge ([#1697](https://github.com/casey/just/pull/1697)) +- Fix set tempdir grammar ([#1695](https://github.com/casey/just/pull/1695)) +- Add version to attributes ([#1694](https://github.com/casey/just/pull/1694) by [JoeyTeng](https://github.com/JoeyTeng)) +- Update README.md ([#1691](https://github.com/casey/just/pull/1691) by [laniakea64](https://github.com/laniakea64)) + + [1.15.0](https://github.com/casey/just/releases/tag/1.15.0) - 2023-10-09 ------------------------------------------------------------------------ diff --git a/Cargo.lock b/Cargo.lock index 4aa30724fe..600a0b5dca 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "aho-corasick" -version = "1.1.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea5d730647d4fadd988536d06fecce94b7b4f2a7efdae548f1cf4b63205518ab" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" dependencies = [ "memchr", ] @@ -39,9 +39,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" [[package]] name = "block-buffer" @@ -93,9 +93,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.9" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" +checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" dependencies = [ "libc", ] @@ -195,9 +195,9 @@ dependencies = [ [[package]] name = "errno" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" +checksum = "7c18ee0ed65a5f1f81cac6b1d213b69c35fa47d4252ad41f1486dbd8226fe36e" dependencies = [ "libc", "windows-sys", @@ -244,9 +244,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" dependencies = [ "cfg-if", "libc", @@ -317,7 +317,7 @@ checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "just" -version = "1.15.0" +version = "1.16.0" dependencies = [ "ansi_term", "atty", @@ -337,6 +337,7 @@ dependencies = [ "num_cpus", "pretty_assertions", "regex", + "semver", "serde", "serde_json", "sha2", @@ -367,9 +368,9 @@ checksum = "441225017b106b9f902e97947a6d31e44ebcf274b91bdbfb51e5c477fcd468e5" [[package]] name = "libc" -version = "0.2.149" +version = "0.2.150" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" +checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" [[package]] name = "linked-hash-map" @@ -379,9 +380,9 @@ checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" [[package]] name = "linux-raw-sys" -version = "0.4.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" +checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829" [[package]] name = "log" @@ -401,7 +402,7 @@ version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.1", "cfg-if", "libc", ] @@ -497,9 +498,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.3.5" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" dependencies = [ "bitflags 1.3.2", ] @@ -515,13 +516,13 @@ dependencies = [ [[package]] name = "regex" -version = "1.9.6" +version = "1.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebee201405406dbf528b8b672104ae6d6d63e6d118cb10e4d51abbc7b58044ff" +checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.3.9", + "regex-automata 0.4.3", "regex-syntax", ] @@ -533,9 +534,9 @@ checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" [[package]] name = "regex-automata" -version = "0.3.9" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59b23e92ee4318893fa3fe3e6fb365258efbfe6ac6ab30f090cdcbb7aa37efa9" +checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" dependencies = [ "aho-corasick", "memchr", @@ -544,17 +545,17 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.7.5" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "rustix" -version = "0.38.17" +version = "0.38.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f25469e9ae0f3d0047ca8b93fc56843f38e6774f0914a107ff8b41be8be8e0b7" +checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.1", "errno", "libc", "linux-raw-sys", @@ -573,31 +574,37 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +[[package]] +name = "semver" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" + [[package]] name = "serde" -version = "1.0.188" +version = "1.0.192" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" +checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.188" +version = "1.0.192" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" +checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] name = "serde_json" -version = "1.0.107" +version = "1.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" +checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" dependencies = [ "itoa", "ryu", @@ -688,15 +695,15 @@ dependencies = [ [[package]] name = "strum_macros" -version = "0.25.2" +version = "0.25.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad8d03b598d3d0fff69bf533ee3ef19b8eeb342729596df84bcc7e1f96ec4059" +checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" dependencies = [ "heck 0.4.1", "proc-macro2", "quote", "rustversion", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -712,9 +719,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.38" +version = "2.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" +checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" dependencies = [ "proc-macro2", "quote", @@ -729,9 +736,9 @@ checksum = "ba852e71502340e2eaf2fa51f9b3ec6aa25750da1aa65771491c69d67789b05c" [[package]] name = "tempfile" -version = "3.8.0" +version = "3.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" +checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" dependencies = [ "cfg-if", "fastrand", @@ -826,9 +833,9 @@ dependencies = [ [[package]] name = "uuid" -version = "1.4.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79daa5ed5740825c40b389c5e50312b9c86df53fccd33f281df655642b43869d" +checksum = "88ad59a7560b41a70d191093a945f0b87bc1deeda46fb237479708a1d6b6cdfc" dependencies = [ "getrandom", ] @@ -853,14 +860,15 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "which" -version = "4.4.2" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" +checksum = "9bf3ea8596f3a0dd5980b46430f2058dfe2c36a27ccfbb1845d6fbfcd9ba6e14" dependencies = [ "either", "home", "once_cell", "rustix", + "windows-sys", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 20ba6d92dc..f636509ae5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "just" -version = "1.15.0" +version = "1.16.0" authors = ["Casey Rodarmor "] autotests = false categories = ["command-line-utilities", "development-tools"] @@ -33,6 +33,7 @@ libc = "0.2.0" log = "0.4.4" num_cpus = "1.15.0" regex = "1.5.4" +semver = "1.0.20" serde = { version = "1.0.130", features = ["derive", "rc"] } serde_json = "1.0.68" sha2 = "0.10" @@ -50,7 +51,7 @@ cradle = "0.2.0" executable-path = "1.0.0" pretty_assertions = "1.0.0" temptree = "0.2.0" -which = "4.0.0" +which = "5.0.0" yaml-rust = "0.4.5" [lib] diff --git a/README.md b/README.md index db3033aab1..9ca440b6d3 100644 --- a/README.md +++ b/README.md @@ -1241,6 +1241,10 @@ These functions can fail, for example if a path does not have an extension, whic - `sha256_file(path)` - Return the SHA-256 hash of the file at `path` as a hexadecimal string. - `uuid()` - Return a randomly generated UUID. +#### Semantic Versions + +- `semver_matches(version, requirement)`1.16.0 - Check whether a [semantic `version`](https://semver.org), e.g., `"0.1.0"` matches a `requirement`, e.g., `">=0.1.0"`, returning `"true"` if so and `"false"` otherwise. + ### Recipe Attributes Recipes may be annotated with attributes that change their behavior. @@ -2172,7 +2176,7 @@ Bar! `just` normally prints error messages when a recipe line fails. These error messages can be suppressed using the `[no-exit-message]`1.7.0 attribute. You may find -this especially useful with a recipe that recipe wraps a tool: +this especially useful with a recipe that wraps a tool: ```just git *args: diff --git a/completions/just.fish b/completions/just.fish index 0771de0135..7aedd4a81d 100644 --- a/completions/just.fish +++ b/completions/just.fish @@ -1,5 +1,31 @@ function __fish_just_complete_recipes - just --list 2> /dev/null | sed -e '1d; s/^\s*\([^[:space:]]*\)[^#]*$/\1/' -e 's/^\s*\([^[:space:]]*\)[^#]*# \(.*\)$/\1\t\2/' + just --list 2> /dev/null | tail -n +2 | awk '{ + command = $1; + args = $0; + desc = ""; + delim = ""; + sub(/^[[:space:]]*[^[:space:]]*/, "", args); + gsub(/^[[:space:]]+|[[:space:]]+$/, "", args); + + if (match(args, /#.*/)) { + desc = substr(args, RSTART+2, RLENGTH); + args = substr(args, 0, RSTART-1); + gsub(/^[[:space:]]+|[[:space:]]+$/, "", args); + } + + gsub(/\+|=[`\'"][^`\'"]*[`\'"]/, "", args); + gsub(/ /, ",", args); + + if (args != ""){ + args = "Args: " args; + } + + if (args != "" && desc != "") { + delim = "; "; + } + + print command "\t" args delim desc + }' end # don't suggest files right off diff --git a/justfile b/justfile index 2518a92f85..37b442bc4b 100755 --- a/justfile +++ b/justfile @@ -53,6 +53,7 @@ view-man: man # add git log messages to changelog update-changelog: + echo >> CHANGELOG.md git log --pretty='format:- %s' >> CHANGELOG.md update-contributors: diff --git a/man/just.1 b/man/just.1 index b3d780b82b..6d4809a6a1 100644 --- a/man/just.1 +++ b/man/just.1 @@ -1,9 +1,9 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3. -.TH JUST "1" "October 2023" "just 1.15.0" "Just Manual" +.TH JUST "1" "November 2023" "just 1.16.0" "Just Manual" .SH NAME just \- save and run commands .SH DESCRIPTION -just 1.15.0 +just 1.16.0 \- Please see https://github.com/casey/just for more information. .SS "USAGE:" .IP @@ -95,6 +95,10 @@ Print colorful output [default: auto] .IP Run an arbitrary command with the working directory, `.env`, overrides, and exports set .HP +\fB\-\-command\-color\fR +.IP +Echo recipe lines in [possible values: black, blue, cyan, green, purple, red, yellow] +.HP \fB\-\-completions\fR .IP Print shell completion script for [possible values: zsh, bash, fish, powershell, elvish] diff --git a/src/completions.rs b/src/completions.rs index 3d805ff045..36999ee88e 100644 --- a/src/completions.rs +++ b/src/completions.rs @@ -1,5 +1,31 @@ pub(crate) const FISH_RECIPE_COMPLETIONS: &str = r#"function __fish_just_complete_recipes - just --list 2> /dev/null | sed -e '1d; s/^\s*\([^[:space:]]*\)[^#]*$/\1/' -e 's/^\s*\([^[:space:]]*\)[^#]*# \(.*\)$/\1\t\2/' + just --list 2> /dev/null | tail -n +2 | awk '{ + command = $1; + args = $0; + desc = ""; + delim = ""; + sub(/^[[:space:]]*[^[:space:]]*/, "", args); + gsub(/^[[:space:]]+|[[:space:]]+$/, "", args); + + if (match(args, /#.*/)) { + desc = substr(args, RSTART+2, RLENGTH); + args = substr(args, 0, RSTART-1); + gsub(/^[[:space:]]+|[[:space:]]+$/, "", args); + } + + gsub(/\+|=[`\'"][^`\'"]*[`\'"]/, "", args); + gsub(/ /, ",", args); + + if (args != ""){ + args = "Args: " args; + } + + if (args != "" && desc != "") { + delim = "; "; + } + + print command "\t" args delim desc + }' end # don't suggest files right off diff --git a/src/function.rs b/src/function.rs index 84c21c0352..086ede1b81 100644 --- a/src/function.rs +++ b/src/function.rs @@ -4,6 +4,7 @@ use { ToKebabCase, ToLowerCamelCase, ToShoutyKebabCase, ToShoutySnakeCase, ToSnakeCase, ToTitleCase, ToUpperCamelCase, }, + semver::{Version, VersionReq}, Function::*, }; @@ -46,6 +47,7 @@ pub(crate) fn get(name: &str) -> Option { "quote" => Unary(quote), "replace" => Ternary(replace), "replace_regex" => Ternary(replace_regex), + "semver_matches" => Binary(semver_matches), "sha256" => Unary(sha256), "sha256_file" => Unary(sha256_file), "shoutykebabcase" => Unary(shoutykebabcase), @@ -411,3 +413,23 @@ fn without_extension(_context: &FunctionContext, path: &str) -> Result=0.1.0") +fn semver_matches( + _context: &FunctionContext, + version: &str, + requirement: &str, +) -> Result { + Ok( + requirement + .parse::() + .map_err(|err| format!("invalid semver requirement: {err}"))? + .matches( + &version + .parse::() + .map_err(|err| format!("invalid semver version: {err}"))?, + ) + .to_string(), + ) +} diff --git a/tests/functions.rs b/tests/functions.rs index 5511329adc..150f293d48 100644 --- a/tests/functions.rs +++ b/tests/functions.rs @@ -412,6 +412,21 @@ test! { stderr: "echo Bar\n", } +#[test] +fn semver_matches() { + Test::new() + .justfile( + " + foo: + echo {{ semver_matches('0.1.0', '>=0.1.0') }} + echo {{ semver_matches('0.1.0', '=0.0.1') }} + ", + ) + .stdout("true\nfalse\n") + .stderr("echo true\necho false\n") + .run(); +} + fn assert_eval_eq(expression: &str, result: &str) { Test::new() .justfile(format!("x := {expression}")) diff --git a/tests/test.rs b/tests/test.rs index e8dc786bb7..4aad92b730 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -39,6 +39,7 @@ pub(crate) struct Output { pub(crate) tempdir: TempDir, } +#[must_use] pub(crate) struct Test { pub(crate) args: Vec, pub(crate) current_dir: PathBuf,