From 492baa4da85de48282a031b2f13415a376e102e6 Mon Sep 17 00:00:00 2001 From: Jake Ireland Date: Fri, 30 Jan 2026 10:19:49 +1300 Subject: [PATCH 01/11] Add attribute support for other BSD variants See also #2497, which added support for OpenBSD. This might help towards a complete solution for #1682. --- README.md | 3 +++ crates-io-readme.md | 2 +- src/attribute.rs | 12 ++++++++++++ src/recipe.rs | 8 +++++++- tests/attributes.rs | 11 +++++++---- tests/os_attributes.rs | 27 +++++++++++++++++++++++++++ 6 files changed, 57 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index d5f93b5001..ec2662ce58 100644 --- a/README.md +++ b/README.md @@ -2148,6 +2148,9 @@ change their behavior. | `[no-exit-message]`1.7.0 | recipe | Don't print an error message if recipe fails. | | `[no-quiet]`1.23.0 | recipe | Override globally quiet recipes and always echo out the recipe. | | `[openbsd]`1.38.0 | recipe | Enable recipe on OpenBSD. | +| `[freebsd]`master | recipe | Enable recipe on FreeBSD. | +| `[dragonfly]`master | recipe | Enable recipe on Dragonfly. | +| `[netbsd]`master | recipe | Enable recipe on NetBSD. | | `[parallel]`1.42.0 | recipe | Run this recipe's dependencies in parallel. | | `[positional-arguments]`1.29.0 | recipe | Turn on [positional arguments](#positional-arguments) for this recipe. | | `[private]`1.10.0 | alias, recipe | Make recipe, alias, or variable private. See [Private Recipes](#private-recipes). | diff --git a/crates-io-readme.md b/crates-io-readme.md index 63c900f2b6..ed2351ae8e 100644 --- a/crates-io-readme.md +++ b/crates-io-readme.md @@ -19,6 +19,6 @@ test TEST: build `just` produces detailed error messages and avoids `make`'s idiosyncrasies, so debugging a justfile is easier and less surprising than debugging a makefile. -It works on all operating systems supported by Rust. +It works on Linux, MacOS, Windows, and BSD variants OpenBSD, FreeBSD, Dragonfly, and NetBSD. Read more on [GitHub](https://github.com/casey/just). diff --git a/src/attribute.rs b/src/attribute.rs index 1cf9a71b78..cbb1fa697e 100644 --- a/src/attribute.rs +++ b/src/attribute.rs @@ -33,6 +33,9 @@ pub(crate) enum Attribute<'src> { NoExitMessage, NoQuiet, Openbsd, + Freebsd, + Dragonfly, + Netbsd, Parallel, PositionalArguments, Private, @@ -53,6 +56,9 @@ impl AttributeDiscriminant { | Self::NoExitMessage | Self::NoQuiet | Self::Openbsd + | Self::Freebsd + | Self::Dragonfly + | Self::Netbsd | Self::Parallel | Self::PositionalArguments | Self::Private @@ -189,6 +195,9 @@ impl<'src> Attribute<'src> { AttributeDiscriminant::NoExitMessage => Self::NoExitMessage, AttributeDiscriminant::NoQuiet => Self::NoQuiet, AttributeDiscriminant::Openbsd => Self::Openbsd, + AttributeDiscriminant::Freebsd => Self::Freebsd, + AttributeDiscriminant::Dragonfly => Self::Dragonfly, + AttributeDiscriminant::Netbsd => Self::Netbsd, AttributeDiscriminant::Parallel => Self::Parallel, AttributeDiscriminant::PositionalArguments => Self::PositionalArguments, AttributeDiscriminant::Private => Self::Private, @@ -296,6 +305,9 @@ impl Display for Attribute<'_> { | Self::NoExitMessage | Self::NoQuiet | Self::Openbsd + | Self::Freebsd + | Self::Dragonfly + | Self::Netbsd | Self::Parallel | Self::PositionalArguments | Self::Private diff --git a/src/recipe.rs b/src/recipe.rs index 4b1026fa98..46275c4616 100644 --- a/src/recipe.rs +++ b/src/recipe.rs @@ -157,13 +157,19 @@ impl<'src, D> Recipe<'src, D> { let linux = self.attributes.contains(AttributeDiscriminant::Linux); let macos = self.attributes.contains(AttributeDiscriminant::Macos); let openbsd = self.attributes.contains(AttributeDiscriminant::Openbsd); + let freebsd = self.attributes.contains(AttributeDiscriminant::Freebsd); + let dragonfly = self.attributes.contains(AttributeDiscriminant::Dragonfly); + let netbsd = self.attributes.contains(AttributeDiscriminant::Netbsd); let unix = self.attributes.contains(AttributeDiscriminant::Unix); let windows = self.attributes.contains(AttributeDiscriminant::Windows); - (!windows && !linux && !macos && !openbsd && !unix) + (!windows && !linux && !macos && !openbsd && !freebsd && !dragonfly && !netbsd && !unix) || (cfg!(target_os = "linux") && (linux || unix)) || (cfg!(target_os = "macos") && (macos || unix)) || (cfg!(target_os = "openbsd") && (openbsd || unix)) + || (cfg!(target_os = "freebsd") && (freebsd || unix)) + || (cfg!(target_os = "dragonfly") && (dragonfly || unix)) + || (cfg!(target_os = "netbsd") && (netbsd || unix)) || (cfg!(target_os = "windows") && windows) || (cfg!(unix) && unix) || (cfg!(windows) && windows) diff --git a/tests/attributes.rs b/tests/attributes.rs index 6360712db3..5b232b61c7 100644 --- a/tests/attributes.rs +++ b/tests/attributes.rs @@ -8,6 +8,9 @@ fn all() { [macos] [linux] [openbsd] + [freebsd] + [dragonfly] + [netbsd] [unix] [windows] [no-exit-message] @@ -47,7 +50,7 @@ fn multiple_attributes_one_line() { Test::new() .justfile( " - [macos,windows,linux,openbsd] + [macos,windows,linux,openbsd,freebsd,dragonfly,netbsd] [no-exit-message] foo: exit 1 @@ -62,7 +65,7 @@ fn multiple_attributes_one_line_error_message() { Test::new() .justfile( " - [macos,windows linux,openbsd] + [macos,windows linux,openbsd,freebsd,dragonfly,netbsd] [no-exit-message] foo: exit 1 @@ -73,7 +76,7 @@ fn multiple_attributes_one_line_error_message() { error: Expected ']', ':', ',', or '(', but found identifier ——▶ justfile:1:16 │ - 1 │ [macos,windows linux,openbsd] + 1 │ [macos,windows linux,openbsd,freebsd,dragonfly,netbsd] │ ^^^^^ ", ) @@ -85,7 +88,7 @@ fn multiple_attributes_one_line_duplicate_check() { Test::new() .justfile( " - [macos, windows, linux, openbsd] + [macos, windows, linux, openbsd, freebsd, dragonfly, netbsd] [linux] foo: exit 1 diff --git a/tests/os_attributes.rs b/tests/os_attributes.rs index e4fc98c793..17e828d9fe 100644 --- a/tests/os_attributes.rs +++ b/tests/os_attributes.rs @@ -51,6 +51,18 @@ fn os() { [openbsd] foo: echo bob + + [freebsd] + foo: + echo corge + + [dragonfly] + foo: + echo grault + + [netbsd] + foo: + echo garply ", ) .stdout(if cfg!(target_os = "macos") { @@ -61,6 +73,12 @@ fn os() { "quxx\n" } else if cfg!(target_os = "openbsd") { "bob\n" + } else if cfg!(target_os = "freebsd") { + "corge\n" + } else if cfg!(target_os = "dragonfly") { + "grault\n" + } else if cfg!(target_os = "netbsd") { + "garply\n" } else { panic!("unexpected os family") }) @@ -72,6 +90,12 @@ fn os() { "echo quxx\n" } else if cfg!(target_os = "openbsd") { "echo bob\n" + } else if cfg!(target_os = "freebsd") { + "echo corge\n" + } else if cfg!(target_os = "dragonfly") { + "echo grault\n" + } else if cfg!(target_os = "netbsd") { + "echo garply\n" } else { panic!("unexpected os family") }) @@ -86,6 +110,9 @@ fn all() { [linux] [macos] [openbsd] + [freebsd] + [dragonfly] + [netbsd] [unix] [windows] foo: From 4ca7b4447352fcf2cd43c8e15cb967f5c9dce919 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Sun, 8 Mar 2026 19:42:19 -0700 Subject: [PATCH 02/11] Adjust --- crates-io-readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates-io-readme.md b/crates-io-readme.md index ed2351ae8e..63c900f2b6 100644 --- a/crates-io-readme.md +++ b/crates-io-readme.md @@ -19,6 +19,6 @@ test TEST: build `just` produces detailed error messages and avoids `make`'s idiosyncrasies, so debugging a justfile is easier and less surprising than debugging a makefile. -It works on Linux, MacOS, Windows, and BSD variants OpenBSD, FreeBSD, Dragonfly, and NetBSD. +It works on all operating systems supported by Rust. Read more on [GitHub](https://github.com/casey/just). From c801f90694e4d28e03fb6375eda167f2616a3821 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Sun, 8 Mar 2026 19:42:54 -0700 Subject: [PATCH 03/11] Modify --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 02e022d44c..f3d13313bc 100644 --- a/README.md +++ b/README.md @@ -2153,7 +2153,7 @@ change their behavior. | `[no-quiet]`1.23.0 | recipe | Override globally quiet recipes and always echo out the recipe. | | `[openbsd]`1.38.0 | recipe | Enable recipe on OpenBSD. | | `[freebsd]`master | recipe | Enable recipe on FreeBSD. | -| `[dragonfly]`master | recipe | Enable recipe on Dragonfly. | +| `[dragonfly]`master | recipe | Enable recipe on DragonFly BSD. | | `[netbsd]`master | recipe | Enable recipe on NetBSD. | | `[parallel]`1.42.0 | recipe | Run this recipe's dependencies in parallel. | | `[positional-arguments]`1.29.0 | recipe | Turn on [positional arguments](#positional-arguments) for this recipe. | From a62823ffea42503fa07b17c50348f5e5bd22d185 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Sun, 8 Mar 2026 19:45:35 -0700 Subject: [PATCH 04/11] Reform --- src/attribute.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/attribute.rs b/src/attribute.rs index 1e84c6643a..b8fb9d1fe3 100644 --- a/src/attribute.rs +++ b/src/attribute.rs @@ -23,20 +23,20 @@ pub(crate) enum Attribute<'src> { Confirm(Option>), Default, Doc(Option>), + Dragonfly, Env(StringLiteral<'src>, StringLiteral<'src>), ExitMessage, Extension(StringLiteral<'src>), + Freebsd, Group(StringLiteral<'src>), Linux, Macos, Metadata(Vec>), + Netbsd, NoCd, NoExitMessage, NoQuiet, Openbsd, - Freebsd, - Dragonfly, - Netbsd, Parallel, PositionalArguments, Private, From d6b2e003fe69468121cc09ff5b563ab37a64f510 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Sun, 8 Mar 2026 19:46:10 -0700 Subject: [PATCH 05/11] Modify --- src/attribute.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/attribute.rs b/src/attribute.rs index b8fb9d1fe3..0a1421e480 100644 --- a/src/attribute.rs +++ b/src/attribute.rs @@ -50,16 +50,16 @@ impl AttributeDiscriminant { fn argument_range(self) -> RangeInclusive { match self { Self::Default + | Self::Dragonfly | Self::ExitMessage + | Self::Freebsd | Self::Linux | Self::Macos + | Self::Netbsd | Self::NoCd | Self::NoExitMessage | Self::NoQuiet | Self::Openbsd - | Self::Freebsd - | Self::Dragonfly - | Self::Netbsd | Self::Parallel | Self::PositionalArguments | Self::Private From 8197f357eaf18fd62913230e42419ee335f1be4e Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Sun, 8 Mar 2026 19:46:39 -0700 Subject: [PATCH 06/11] Enhance --- src/attribute.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/attribute.rs b/src/attribute.rs index 0a1421e480..fcd1cd16b1 100644 --- a/src/attribute.rs +++ b/src/attribute.rs @@ -187,23 +187,23 @@ impl<'src> Attribute<'src> { AttributeDiscriminant::Confirm => Self::Confirm(arguments.into_iter().next()), AttributeDiscriminant::Default => Self::Default, AttributeDiscriminant::Doc => Self::Doc(arguments.into_iter().next()), + AttributeDiscriminant::Dragonfly => Self::Dragonfly, AttributeDiscriminant::Env => { let [key, value]: [StringLiteral; 2] = arguments.try_into().unwrap(); Self::Env(key, value) } AttributeDiscriminant::ExitMessage => Self::ExitMessage, AttributeDiscriminant::Extension => Self::Extension(arguments.into_iter().next().unwrap()), + AttributeDiscriminant::Freebsd => Self::Freebsd, AttributeDiscriminant::Group => Self::Group(arguments.into_iter().next().unwrap()), AttributeDiscriminant::Linux => Self::Linux, AttributeDiscriminant::Macos => Self::Macos, AttributeDiscriminant::Metadata => Self::Metadata(arguments), + AttributeDiscriminant::Netbsd => Self::Netbsd, AttributeDiscriminant::NoCd => Self::NoCd, AttributeDiscriminant::NoExitMessage => Self::NoExitMessage, AttributeDiscriminant::NoQuiet => Self::NoQuiet, AttributeDiscriminant::Openbsd => Self::Openbsd, - AttributeDiscriminant::Freebsd => Self::Freebsd, - AttributeDiscriminant::Dragonfly => Self::Dragonfly, - AttributeDiscriminant::Netbsd => Self::Netbsd, AttributeDiscriminant::Parallel => Self::Parallel, AttributeDiscriminant::PositionalArguments => Self::PositionalArguments, AttributeDiscriminant::Private => Self::Private, From 8fc5b6850b150504e232d6aaf9e37eec84a0924d Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Sun, 8 Mar 2026 19:46:52 -0700 Subject: [PATCH 07/11] Tweak --- src/attribute.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/attribute.rs b/src/attribute.rs index fcd1cd16b1..112761096c 100644 --- a/src/attribute.rs +++ b/src/attribute.rs @@ -304,16 +304,16 @@ impl Display for Attribute<'_> { Self::Confirm(None) | Self::Default | Self::Doc(None) + | Self::Dragonfly | Self::ExitMessage + | Self::Freebsd | Self::Linux | Self::Macos + | Self::Netbsd | Self::NoCd | Self::NoExitMessage | Self::NoQuiet | Self::Openbsd - | Self::Freebsd - | Self::Dragonfly - | Self::Netbsd | Self::Parallel | Self::PositionalArguments | Self::Private From 76eeb276bee78a461ea96379e4ada84febfd5298 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Sun, 8 Mar 2026 19:47:11 -0700 Subject: [PATCH 08/11] Amend --- src/recipe.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/recipe.rs b/src/recipe.rs index 8095bf71da..5bc2c7cde5 100644 --- a/src/recipe.rs +++ b/src/recipe.rs @@ -154,12 +154,12 @@ impl<'src, D> Recipe<'src, D> { } pub(crate) fn enabled(&self) -> bool { + let dragonfly = self.attributes.contains(AttributeDiscriminant::Dragonfly); + let freebsd = self.attributes.contains(AttributeDiscriminant::Freebsd); let linux = self.attributes.contains(AttributeDiscriminant::Linux); let macos = self.attributes.contains(AttributeDiscriminant::Macos); - let openbsd = self.attributes.contains(AttributeDiscriminant::Openbsd); - let freebsd = self.attributes.contains(AttributeDiscriminant::Freebsd); - let dragonfly = self.attributes.contains(AttributeDiscriminant::Dragonfly); let netbsd = self.attributes.contains(AttributeDiscriminant::Netbsd); + let openbsd = self.attributes.contains(AttributeDiscriminant::Openbsd); let unix = self.attributes.contains(AttributeDiscriminant::Unix); let windows = self.attributes.contains(AttributeDiscriminant::Windows); From 936381fc2f1984cc54c1c1b7722ebd11ea790a6d Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Sun, 8 Mar 2026 19:47:19 -0700 Subject: [PATCH 09/11] Tweak --- src/recipe.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/recipe.rs b/src/recipe.rs index 5bc2c7cde5..5ec85ac54e 100644 --- a/src/recipe.rs +++ b/src/recipe.rs @@ -164,12 +164,12 @@ impl<'src, D> Recipe<'src, D> { let windows = self.attributes.contains(AttributeDiscriminant::Windows); (!windows && !linux && !macos && !openbsd && !freebsd && !dragonfly && !netbsd && !unix) + || (cfg!(target_os = "dragonfly") && (dragonfly || unix)) + || (cfg!(target_os = "freebsd") && (freebsd || unix)) || (cfg!(target_os = "linux") && (linux || unix)) || (cfg!(target_os = "macos") && (macos || unix)) - || (cfg!(target_os = "openbsd") && (openbsd || unix)) - || (cfg!(target_os = "freebsd") && (freebsd || unix)) - || (cfg!(target_os = "dragonfly") && (dragonfly || unix)) || (cfg!(target_os = "netbsd") && (netbsd || unix)) + || (cfg!(target_os = "openbsd") && (openbsd || unix)) || (cfg!(target_os = "windows") && windows) || (cfg!(unix) && unix) || (cfg!(windows) && windows) From adaac03d5a82bed81a6095c492de1b30f1066c1f Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Sun, 8 Mar 2026 19:47:30 -0700 Subject: [PATCH 10/11] Adjust --- tests/attributes.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/attributes.rs b/tests/attributes.rs index e392c97b58..d3831d8f39 100644 --- a/tests/attributes.rs +++ b/tests/attributes.rs @@ -5,15 +5,15 @@ fn all() { Test::new() .justfile( " - [macos] - [linux] - [openbsd] - [freebsd] [dragonfly] + [freebsd] + [linux] + [macos] [netbsd] + [no-exit-message] + [openbsd] [unix] [windows] - [no-exit-message] foo: exit 1 ", From 92b30e3006896d326d0cd1f2275baa406a766027 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Sun, 8 Mar 2026 19:48:29 -0700 Subject: [PATCH 11/11] Reform --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index f3d13313bc..6853cad1f0 100644 --- a/README.md +++ b/README.md @@ -2135,31 +2135,31 @@ change their behavior. |------|------|-------------| | `[arg(ARG, help="HELP")]`1.46.0 | recipe | Print help string `HELP` for `ARG` in usage messages. | | `[arg(ARG, long="LONG")]`1.46.0 | recipe | Require values of argument `ARG` to be passed as `--LONG` option. | +| `[arg(ARG, pattern="PATTERN")]`1.45.0 | recipe | Require values of argument `ARG` to match regular expression `PATTERN`. | | `[arg(ARG, short="S")]`1.46.0 | recipe | Require values of argument `ARG` to be passed as short `-S` option. | | `[arg(ARG, value="VALUE")]`1.46.0 | recipe | Makes option `ARG` a flag which does not take a value. | -| `[arg(ARG, pattern="PATTERN")]`1.45.0 | recipe | Require values of argument `ARG` to match regular expression `PATTERN`. | -| `[confirm]`1.17.0 | recipe | Require confirmation prior to executing recipe. | | `[confirm(PROMPT)]`1.23.0 | recipe | Require confirmation prior to executing recipe with a custom prompt. | +| `[confirm]`1.17.0 | recipe | Require confirmation prior to executing recipe. | | `[default]`1.43.0 | recipe | Use recipe as module's default recipe. | | `[doc(DOC)]`1.27.0 | module, recipe | Set recipe or module's [documentation comment](#documentation-comments) to `DOC`. | +| `[dragonfly]`master | recipe | Enable recipe on DragonFly BSD. | | `[env(ENV_VAR, VALUE)]` master | recipe | Set environment variables for recipe. | | `[extension(EXT)]`1.32.0 | recipe | Set shebang recipe script's file extension to `EXT`. `EXT` should include a period if one is desired. | +| `[freebsd]`master | recipe | Enable recipe on FreeBSD. | | `[group(NAME)]`1.27.0 | module, recipe | Put recipe or module in [group](#groups) `NAME`. | | `[linux]`1.8.0 | recipe | Enable recipe on Linux. | | `[macos]`1.8.0 | recipe | Enable recipe on MacOS. | | `[metadata(METADATA)]`1.42.0 | recipe | Attach `METADATA` to recipe. | +| `[netbsd]`master | recipe | Enable recipe on NetBSD. | | `[no-cd]`1.9.0 | recipe | Don't change directory before executing recipe. | | `[no-exit-message]`1.7.0 | recipe | Don't print an error message if recipe fails. | | `[no-quiet]`1.23.0 | recipe | Override globally quiet recipes and always echo out the recipe. | | `[openbsd]`1.38.0 | recipe | Enable recipe on OpenBSD. | -| `[freebsd]`master | recipe | Enable recipe on FreeBSD. | -| `[dragonfly]`master | recipe | Enable recipe on DragonFly BSD. | -| `[netbsd]`master | recipe | Enable recipe on NetBSD. | | `[parallel]`1.42.0 | recipe | Run this recipe's dependencies in parallel. | | `[positional-arguments]`1.29.0 | recipe | Turn on [positional arguments](#positional-arguments) for this recipe. | | `[private]`1.10.0 | alias, recipe | Make recipe, alias, or variable private. See [Private Recipes](#private-recipes). | -| `[script]`1.33.0 | recipe | Execute recipe as script. See [script recipes](#script-recipes) for more details. | | `[script(COMMAND)]`1.32.0 | recipe | Execute recipe as a script interpreted by `COMMAND`. See [script recipes](#script-recipes) for more details. | +| `[script]`1.33.0 | recipe | Execute recipe as script. See [script recipes](#script-recipes) for more details. | | `[unix]`1.8.0 | recipe | Enable recipe on Unixes. (Includes MacOS). | | `[windows]`1.8.0 | recipe | Enable recipe on Windows. | | `[working-directory(PATH)]`1.38.0 | recipe | Set recipe working directory. `PATH` may be relative or absolute. If relative, it is interpreted relative to the default working directory. |