Skip to content

Commit 867cd63

Browse files
committed
chore: sync files from source repo
1 parent 4cb4770 commit 867cd63

5 files changed

Lines changed: 61 additions & 10 deletions

File tree

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2135,28 +2135,31 @@ change their behavior.
21352135
|------|------|-------------|
21362136
| `[arg(ARG, help="HELP")]`<sup>1.46.0</sup> | recipe | Print help string `HELP` for `ARG` in usage messages. |
21372137
| `[arg(ARG, long="LONG")]`<sup>1.46.0</sup> | recipe | Require values of argument `ARG` to be passed as `--LONG` option. |
2138+
| `[arg(ARG, pattern="PATTERN")]`<sup>1.45.0</sup> | recipe | Require values of argument `ARG` to match regular expression `PATTERN`. |
21382139
| `[arg(ARG, short="S")]`<sup>1.46.0</sup> | recipe | Require values of argument `ARG` to be passed as short `-S` option. |
21392140
| `[arg(ARG, value="VALUE")]`<sup>1.46.0</sup> | recipe | Makes option `ARG` a flag which does not take a value. |
2140-
| `[arg(ARG, pattern="PATTERN")]`<sup>1.45.0</sup> | recipe | Require values of argument `ARG` to match regular expression `PATTERN`. |
2141-
| `[confirm]`<sup>1.17.0</sup> | recipe | Require confirmation prior to executing recipe. |
21422141
| `[confirm(PROMPT)]`<sup>1.23.0</sup> | recipe | Require confirmation prior to executing recipe with a custom prompt. |
2142+
| `[confirm]`<sup>1.17.0</sup> | recipe | Require confirmation prior to executing recipe. |
21432143
| `[default]`<sup>1.43.0</sup> | recipe | Use recipe as module's default recipe. |
21442144
| `[doc(DOC)]`<sup>1.27.0</sup> | module, recipe | Set recipe or module's [documentation comment](#documentation-comments) to `DOC`. |
2145+
| `[dragonfly]`<sup>master</sup> | recipe | Enable recipe on DragonFly BSD. |
21452146
| `[env(ENV_VAR, VALUE)]` <sup>master</sup> | recipe | Set environment variables for recipe. |
21462147
| `[extension(EXT)]`<sup>1.32.0</sup> | recipe | Set shebang recipe script's file extension to `EXT`. `EXT` should include a period if one is desired. |
2148+
| `[freebsd]`<sup>master</sup> | recipe | Enable recipe on FreeBSD. |
21472149
| `[group(NAME)]`<sup>1.27.0</sup> | module, recipe | Put recipe or module in [group](#groups) `NAME`. |
21482150
| `[linux]`<sup>1.8.0</sup> | recipe | Enable recipe on Linux. |
21492151
| `[macos]`<sup>1.8.0</sup> | recipe | Enable recipe on MacOS. |
21502152
| `[metadata(METADATA)]`<sup>1.42.0</sup> | recipe | Attach `METADATA` to recipe. |
2153+
| `[netbsd]`<sup>master</sup> | recipe | Enable recipe on NetBSD. |
21512154
| `[no-cd]`<sup>1.9.0</sup> | recipe | Don't change directory before executing recipe. |
21522155
| `[no-exit-message]`<sup>1.7.0</sup> | recipe | Don't print an error message if recipe fails. |
21532156
| `[no-quiet]`<sup>1.23.0</sup> | recipe | Override globally quiet recipes and always echo out the recipe. |
21542157
| `[openbsd]`<sup>1.38.0</sup> | recipe | Enable recipe on OpenBSD. |
21552158
| `[parallel]`<sup>1.42.0</sup> | recipe | Run this recipe's dependencies in parallel. |
21562159
| `[positional-arguments]`<sup>1.29.0</sup> | recipe | Turn on [positional arguments](#positional-arguments) for this recipe. |
21572160
| `[private]`<sup>1.10.0</sup> | alias, recipe | Make recipe, alias, or variable private. See [Private Recipes](#private-recipes). |
2158-
| `[script]`<sup>1.33.0</sup> | recipe | Execute recipe as script. See [script recipes](#script-recipes) for more details. |
21592161
| `[script(COMMAND)]`<sup>1.32.0</sup> | recipe | Execute recipe as a script interpreted by `COMMAND`. See [script recipes](#script-recipes) for more details. |
2162+
| `[script]`<sup>1.33.0</sup> | recipe | Execute recipe as script. See [script recipes](#script-recipes) for more details. |
21602163
| `[unix]`<sup>1.8.0</sup> | recipe | Enable recipe on Unixes. (Includes MacOS). |
21612164
| `[windows]`<sup>1.8.0</sup> | recipe | Enable recipe on Windows. |
21622165
| `[working-directory(PATH)]`<sup>1.38.0</sup> | recipe | Set recipe working directory. `PATH` may be relative or absolute. If relative, it is interpreted relative to the default working directory. |

src/attribute.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,16 @@ pub(crate) enum Attribute<'src> {
2323
Confirm(Option<StringLiteral<'src>>),
2424
Default,
2525
Doc(Option<StringLiteral<'src>>),
26+
Dragonfly,
2627
Env(StringLiteral<'src>, StringLiteral<'src>),
2728
ExitMessage,
2829
Extension(StringLiteral<'src>),
30+
Freebsd,
2931
Group(StringLiteral<'src>),
3032
Linux,
3133
Macos,
3234
Metadata(Vec<StringLiteral<'src>>),
35+
Netbsd,
3336
NoCd,
3437
NoExitMessage,
3538
NoQuiet,
@@ -47,9 +50,12 @@ impl AttributeDiscriminant {
4750
fn argument_range(self) -> RangeInclusive<usize> {
4851
match self {
4952
Self::Default
53+
| Self::Dragonfly
5054
| Self::ExitMessage
55+
| Self::Freebsd
5156
| Self::Linux
5257
| Self::Macos
58+
| Self::Netbsd
5359
| Self::NoCd
5460
| Self::NoExitMessage
5561
| Self::NoQuiet
@@ -181,16 +187,19 @@ impl<'src> Attribute<'src> {
181187
AttributeDiscriminant::Confirm => Self::Confirm(arguments.into_iter().next()),
182188
AttributeDiscriminant::Default => Self::Default,
183189
AttributeDiscriminant::Doc => Self::Doc(arguments.into_iter().next()),
190+
AttributeDiscriminant::Dragonfly => Self::Dragonfly,
184191
AttributeDiscriminant::Env => {
185192
let [key, value]: [StringLiteral; 2] = arguments.try_into().unwrap();
186193
Self::Env(key, value)
187194
}
188195
AttributeDiscriminant::ExitMessage => Self::ExitMessage,
189196
AttributeDiscriminant::Extension => Self::Extension(arguments.into_iter().next().unwrap()),
197+
AttributeDiscriminant::Freebsd => Self::Freebsd,
190198
AttributeDiscriminant::Group => Self::Group(arguments.into_iter().next().unwrap()),
191199
AttributeDiscriminant::Linux => Self::Linux,
192200
AttributeDiscriminant::Macos => Self::Macos,
193201
AttributeDiscriminant::Metadata => Self::Metadata(arguments),
202+
AttributeDiscriminant::Netbsd => Self::Netbsd,
194203
AttributeDiscriminant::NoCd => Self::NoCd,
195204
AttributeDiscriminant::NoExitMessage => Self::NoExitMessage,
196205
AttributeDiscriminant::NoQuiet => Self::NoQuiet,
@@ -295,9 +304,12 @@ impl Display for Attribute<'_> {
295304
Self::Confirm(None)
296305
| Self::Default
297306
| Self::Doc(None)
307+
| Self::Dragonfly
298308
| Self::ExitMessage
309+
| Self::Freebsd
299310
| Self::Linux
300311
| Self::Macos
312+
| Self::Netbsd
301313
| Self::NoCd
302314
| Self::NoExitMessage
303315
| Self::NoQuiet

src/recipe.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,21 @@ impl<'src, D> Recipe<'src, D> {
154154
}
155155

156156
pub(crate) fn enabled(&self) -> bool {
157+
let dragonfly = self.attributes.contains(AttributeDiscriminant::Dragonfly);
158+
let freebsd = self.attributes.contains(AttributeDiscriminant::Freebsd);
157159
let linux = self.attributes.contains(AttributeDiscriminant::Linux);
158160
let macos = self.attributes.contains(AttributeDiscriminant::Macos);
161+
let netbsd = self.attributes.contains(AttributeDiscriminant::Netbsd);
159162
let openbsd = self.attributes.contains(AttributeDiscriminant::Openbsd);
160163
let unix = self.attributes.contains(AttributeDiscriminant::Unix);
161164
let windows = self.attributes.contains(AttributeDiscriminant::Windows);
162165

163-
(!windows && !linux && !macos && !openbsd && !unix)
166+
(!windows && !linux && !macos && !openbsd && !freebsd && !dragonfly && !netbsd && !unix)
167+
|| (cfg!(target_os = "dragonfly") && (dragonfly || unix))
168+
|| (cfg!(target_os = "freebsd") && (freebsd || unix))
164169
|| (cfg!(target_os = "linux") && (linux || unix))
165170
|| (cfg!(target_os = "macos") && (macos || unix))
171+
|| (cfg!(target_os = "netbsd") && (netbsd || unix))
166172
|| (cfg!(target_os = "openbsd") && (openbsd || unix))
167173
|| (cfg!(target_os = "windows") && windows)
168174
|| (cfg!(unix) && unix)

tests/attributes.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,15 @@ fn all() {
55
Test::new()
66
.justfile(
77
"
8-
[macos]
8+
[dragonfly]
9+
[freebsd]
910
[linux]
11+
[macos]
12+
[netbsd]
13+
[no-exit-message]
1014
[openbsd]
1115
[unix]
1216
[windows]
13-
[no-exit-message]
1417
foo:
1518
exit 1
1619
",
@@ -47,7 +50,7 @@ fn multiple_attributes_one_line() {
4750
Test::new()
4851
.justfile(
4952
"
50-
[macos,windows,linux,openbsd]
53+
[macos,windows,linux,openbsd,freebsd,dragonfly,netbsd]
5154
[no-exit-message]
5255
foo:
5356
exit 1
@@ -62,7 +65,7 @@ fn multiple_attributes_one_line_error_message() {
6265
Test::new()
6366
.justfile(
6467
"
65-
[macos,windows linux,openbsd]
68+
[macos,windows linux,openbsd,freebsd,dragonfly,netbsd]
6669
[no-exit-message]
6770
foo:
6871
exit 1
@@ -73,7 +76,7 @@ fn multiple_attributes_one_line_error_message() {
7376
error: Expected ']', ':', ',', or '(', but found identifier
7477
——▶ justfile:1:16
7578
76-
1 │ [macos,windows linux,openbsd]
79+
1 │ [macos,windows linux,openbsd,freebsd,dragonfly,netbsd]
7780
│ ^^^^^
7881
",
7982
)
@@ -85,7 +88,7 @@ fn multiple_attributes_one_line_duplicate_check() {
8588
Test::new()
8689
.justfile(
8790
"
88-
[macos, windows, linux, openbsd]
91+
[macos, windows, linux, openbsd, freebsd, dragonfly, netbsd]
8992
[linux]
9093
foo:
9194
exit 1

tests/os_attributes.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,18 @@ fn os() {
5151
[openbsd]
5252
foo:
5353
echo bob
54+
55+
[freebsd]
56+
foo:
57+
echo corge
58+
59+
[dragonfly]
60+
foo:
61+
echo grault
62+
63+
[netbsd]
64+
foo:
65+
echo garply
5466
",
5567
)
5668
.stdout(if cfg!(target_os = "macos") {
@@ -61,6 +73,12 @@ fn os() {
6173
"quxx\n"
6274
} else if cfg!(target_os = "openbsd") {
6375
"bob\n"
76+
} else if cfg!(target_os = "freebsd") {
77+
"corge\n"
78+
} else if cfg!(target_os = "dragonfly") {
79+
"grault\n"
80+
} else if cfg!(target_os = "netbsd") {
81+
"garply\n"
6482
} else {
6583
panic!("unexpected os family")
6684
})
@@ -72,6 +90,12 @@ fn os() {
7290
"echo quxx\n"
7391
} else if cfg!(target_os = "openbsd") {
7492
"echo bob\n"
93+
} else if cfg!(target_os = "freebsd") {
94+
"echo corge\n"
95+
} else if cfg!(target_os = "dragonfly") {
96+
"echo grault\n"
97+
} else if cfg!(target_os = "netbsd") {
98+
"echo garply\n"
7599
} else {
76100
panic!("unexpected os family")
77101
})
@@ -86,6 +110,9 @@ fn all() {
86110
[linux]
87111
[macos]
88112
[openbsd]
113+
[freebsd]
114+
[dragonfly]
115+
[netbsd]
89116
[unix]
90117
[windows]
91118
foo:

0 commit comments

Comments
 (0)