Skip to content

Commit

Permalink
Updates based upon PR feedback.
Browse files Browse the repository at this point in the history
Rename `quiet-recipes` to quiet.
Rename `no-quiet-recipes` to `no-quiet`.

-=david=-
  • Loading branch information
dharrigan committed Dec 24, 2023
1 parent 91fdab7 commit 01c030d
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 58 deletions.
2 changes: 1 addition & 1 deletion GRAMMAR.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ setting : 'set' 'allow-duplicate-recipes' boolean?
| 'set' 'fallback' boolean?
| 'set' 'ignore-comments' boolean?
| 'set' 'positional-arguments' boolean?
| 'set' 'quiet-recipes' boolean?
| 'set' 'quiet' boolean?
| 'set' 'shell' ':=' '[' string (',' string)* ','? ']'
| 'set' 'tempdir ':=' string
| 'set' 'windows-powershell' boolean?
Expand Down
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1248,16 +1248,16 @@ These functions can fail, for example if a path does not have an extension, whic

Recipes may be annotated with attributes that change their behavior.

| Name | Description |
| ----------------------------------- | ----------------------------------------------- |
| `[no-cd]`<sup>1.9.0</sup> | Don't change directory before executing recipe. |
| `[no-exit-message]`<sup>1.7.0</sup> | Don't print an error message if recipe fails. |
| `[no-quiet-recipe]`<sup>?</sup> | Override globally quiet recipe and always echo out the recipe |
| `[linux]`<sup>1.8.0</sup> | Enable recipe on Linux. |
| `[macos]`<sup>1.8.0</sup> | Enable recipe on MacOS. |
| `[unix]`<sup>1.8.0</sup> | Enable recipe on Unixes. (Includes MacOS). |
| `[windows]`<sup>1.8.0</sup> | Enable recipe on Windows. |
| `[private]`<sup>1.10.0</sup> | See [Private Recipes](#private-recipes). |
| Name | Description |
| ----------------------------------- | ----------------------------------------------- |
| `[no-cd]`<sup>1.9.0</sup> | Don't change directory before executing recipe. |
| `[no-exit-message]`<sup>1.7.0</sup> | Don't print an error message if recipe fails. |
| `[no-quiet]`<sup>?</sup> | Override globally quiet recipes and always echo out the recipe |
| `[linux]`<sup>1.8.0</sup> | Enable recipe on Linux. |
| `[macos]`<sup>1.8.0</sup> | Enable recipe on MacOS. |
| `[unix]`<sup>1.8.0</sup> | Enable recipe on Unixes. (Includes MacOS). |
| `[windows]`<sup>1.8.0</sup> | Enable recipe on Windows. |
| `[private]`<sup>1.10.0</sup> | See [Private Recipes](#private-recipes). |

A recipe can have multiple attributes, either on multiple lines:

Expand Down Expand Up @@ -2221,10 +2221,10 @@ goodbye
```

In addition, an entire Justfile can be marked as being globally quiet by
setting `set quiet-recipes` in the Justfile. For example:
setting `set quiet` in the Justfile. For example:

```just
set quiet-recipes
set quiet
foo:
echo "This is quiet"
Expand All @@ -2233,16 +2233,16 @@ foo:
echo "This is also quiet"
```

If the recipe has the attribute of `[no-quiet-recipe]`, then the setting is
If the recipe has the attribute of `[no-quiet]`, then the setting is
ignored: For example:

```just
set quiet-recipes
set quiet
foo:
echo "This is quiet"
[no-quiet-recipe]
[no-quiet]
foo2:
echo "This is not quiet"
```
Expand Down
6 changes: 3 additions & 3 deletions src/attribute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub(crate) enum Attribute {
NoCd,
NoExitMessage,
Private,
NoQuietRecipe,
NoQuiet,
Unix,
Windows,
}
Expand All @@ -37,7 +37,7 @@ mod tests {
}

#[test]
fn no_quiet_recipe_to_str() {
assert_eq!(Attribute::NoQuietRecipe.to_str(), "no-quiet-recipe");
fn no_quiet_to_str() {
assert_eq!(Attribute::NoQuiet.to_str(), "no-quiet");
}
}
2 changes: 1 addition & 1 deletion src/keyword.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub(crate) enum Keyword {
IgnoreComments,
Import,
PositionalArguments,
QuietRecipes,
Quiet,
Set,
Shell,
Tempdir,
Expand Down
2 changes: 1 addition & 1 deletion src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ impl<'src> Node<'src> for Set<'src> {
| Setting::Export(value)
| Setting::Fallback(value)
| Setting::PositionalArguments(value)
| Setting::QuietRecipes(value)
| Setting::Quiet(value)
| Setting::WindowsPowerShell(value)
| Setting::IgnoreComments(value) => {
set.push_mut(value.to_string());
Expand Down
20 changes: 10 additions & 10 deletions src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ impl<'tokens, 'src> Parser<'tokens, 'src> {
Keyword::Fallback => Some(Setting::Fallback(self.parse_set_bool()?)),
Keyword::IgnoreComments => Some(Setting::IgnoreComments(self.parse_set_bool()?)),
Keyword::PositionalArguments => Some(Setting::PositionalArguments(self.parse_set_bool()?)),
Keyword::QuietRecipes => Some(Setting::QuietRecipes(self.parse_set_bool()?)),
Keyword::Quiet => Some(Setting::Quiet(self.parse_set_bool()?)),
Keyword::WindowsPowershell => Some(Setting::WindowsPowerShell(self.parse_set_bool()?)),
_ => None,
};
Expand Down Expand Up @@ -1866,21 +1866,21 @@ mod tests {
}

test! {
name: set_quiet_recipes_implicit,
text: "set quiet-recipes",
tree: (justfile (set quiet_recipes true)),
name: set_quiet_implicit,
text: "set quiet",
tree: (justfile (set quiet true)),
}

test! {
name: set_quiet_recipes_true,
text: "set quiet-recipes := true",
tree: (justfile (set quiet_recipes true)),
name: set_quiet_true,
text: "set quiet := true",
tree: (justfile (set quiet true)),
}

test! {
name: set_quiet_recipes_false,
text: "set quiet-recipes := false",
tree: (justfile (set quiet_recipes false)),
name: set_quiet_false,
text: "set quiet := false",
tree: (justfile (set quiet false)),
}

test! {
Expand Down
10 changes: 5 additions & 5 deletions src/recipe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ impl<'src, D> Recipe<'src, D> {
!self.attributes.contains(&Attribute::NoExitMessage)
}

fn no_quiet_recipe(&self) -> bool {
!self.attributes.contains(&Attribute::NoQuietRecipe)
fn no_quiet(&self) -> bool {
!self.attributes.contains(&Attribute::NoQuiet)
}

pub(crate) fn run<'run>(
Expand Down Expand Up @@ -155,7 +155,7 @@ impl<'src, D> Recipe<'src, D> {
let mut evaluated = String::new();
let mut continued = false;

let quiet_command = self.no_quiet_recipe() && context.settings.quiet_recipes
let quiet_command = self.no_quiet() && context.settings.quiet
|| lines.peek().map_or(false, |line| line.is_quiet());

let infallible_command = lines.peek().map_or(false, |line| line.is_infallible());
Expand Down Expand Up @@ -186,7 +186,7 @@ impl<'src, D> Recipe<'src, D> {

let mut command = evaluated.as_str();

if quiet_command && !context.settings.quiet_recipes {
if quiet_command && !context.settings.quiet {
command = &command[1..];
}

Expand All @@ -201,7 +201,7 @@ impl<'src, D> Recipe<'src, D> {
if config.dry_run
|| config.verbosity.loquacious()
|| !((quiet_command ^ self.quiet)
|| (context.settings.quiet_recipes && self.no_quiet_recipe())
|| (context.settings.quiet && self.no_quiet())
|| config.verbosity.quiet())
{
let color = if config.highlight {
Expand Down
4 changes: 2 additions & 2 deletions src/setting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub(crate) enum Setting<'src> {
Fallback(bool),
IgnoreComments(bool),
PositionalArguments(bool),
QuietRecipes(bool),
Quiet(bool),
Shell(Shell<'src>),
Tempdir(String),
WindowsPowerShell(bool),
Expand All @@ -26,7 +26,7 @@ impl<'src> Display for Setting<'src> {
| Setting::Fallback(value)
| Setting::IgnoreComments(value)
| Setting::PositionalArguments(value)
| Setting::QuietRecipes(value)
| Setting::Quiet(value)
| Setting::WindowsPowerShell(value) => write!(f, "{value}"),
Setting::Shell(shell) | Setting::WindowsShell(shell) => write!(f, "{shell}"),
Setting::DotenvFilename(value) | Setting::DotenvPath(value) | Setting::Tempdir(value) => {
Expand Down
6 changes: 3 additions & 3 deletions src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub(crate) struct Settings<'src> {
pub(crate) fallback: bool,
pub(crate) ignore_comments: bool,
pub(crate) positional_arguments: bool,
pub(crate) quiet_recipes: bool,
pub(crate) quiet: bool,
pub(crate) shell: Option<Shell<'src>>,
pub(crate) tempdir: Option<String>,
pub(crate) windows_powershell: bool,
Expand Down Expand Up @@ -53,8 +53,8 @@ impl<'src> Settings<'src> {
Setting::PositionalArguments(positional_arguments) => {
settings.positional_arguments = positional_arguments;
}
Setting::QuietRecipes(quiet_recipes) => {
settings.quiet_recipes = quiet_recipes;
Setting::Quiet(quiet) => {
settings.quiet = quiet;
}
Setting::Shell(shell) => {
settings.shell = Some(shell);
Expand Down
34 changes: 17 additions & 17 deletions tests/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ fn alias() {
"export": false,
"fallback": false,
"positional_arguments": false,
"quiet_recipes": false,
"quiet": false,
"shell": null,
"tempdir" : null,
"ignore_comments": false,
Expand Down Expand Up @@ -84,7 +84,7 @@ fn assignment() {
"fallback": false,
"ignore_comments": false,
"positional_arguments": false,
"quiet_recipes": false,
"quiet": false,
"shell": null,
"tempdir" : null,
"windows_powershell": false,
Expand Down Expand Up @@ -133,7 +133,7 @@ fn body() {
"fallback": false,
"ignore_comments": false,
"positional_arguments": false,
"quiet_recipes": false,
"quiet": false,
"shell": null,
"tempdir" : null,
"windows_powershell": false,
Expand Down Expand Up @@ -193,7 +193,7 @@ fn dependencies() {
"fallback": false,
"ignore_comments": false,
"positional_arguments": false,
"quiet_recipes": false,
"quiet": false,
"shell": null,
"tempdir" : null,
"windows_powershell": false,
Expand Down Expand Up @@ -290,7 +290,7 @@ fn dependency_argument() {
"fallback": false,
"ignore_comments": false,
"positional_arguments": false,
"quiet_recipes": false,
"quiet": false,
"shell": null,
"tempdir" : null,
"windows_powershell": false,
Expand Down Expand Up @@ -351,7 +351,7 @@ fn duplicate_recipes() {
"fallback": false,
"ignore_comments": false,
"positional_arguments": false,
"quiet_recipes": false,
"quiet": false,
"shell": null,
"tempdir" : null,
"windows_powershell": false,
Expand Down Expand Up @@ -393,7 +393,7 @@ fn doc_comment() {
"fallback": false,
"ignore_comments": false,
"positional_arguments": false,
"quiet_recipes": false,
"quiet": false,
"shell": null,
"tempdir" : null,
"windows_powershell": false,
Expand Down Expand Up @@ -422,7 +422,7 @@ fn empty_justfile() {
"fallback": false,
"ignore_comments": false,
"positional_arguments": false,
"quiet_recipes": false,
"quiet": false,
"shell": null,
"tempdir" : null,
"windows_powershell": false,
Expand Down Expand Up @@ -566,7 +566,7 @@ fn parameters() {
"fallback": false,
"ignore_comments": false,
"positional_arguments": false,
"quiet_recipes": false,
"quiet": false,
"shell": null,
"tempdir" : null,
"windows_powershell": false,
Expand Down Expand Up @@ -646,7 +646,7 @@ fn priors() {
"fallback": false,
"ignore_comments": false,
"positional_arguments": false,
"quiet_recipes": false,
"quiet": false,
"shell": null,
"tempdir" : null,
"windows_powershell": false,
Expand Down Expand Up @@ -688,7 +688,7 @@ fn private() {
"fallback": false,
"ignore_comments": false,
"positional_arguments": false,
"quiet_recipes": false,
"quiet": false,
"shell": null,
"tempdir" : null,
"windows_powershell": false,
Expand Down Expand Up @@ -730,7 +730,7 @@ fn quiet() {
"fallback": false,
"ignore_comments": false,
"positional_arguments": false,
"quiet_recipes": false,
"quiet": false,
"shell": null,
"tempdir" : null,
"windows_powershell": false,
Expand All @@ -751,7 +751,7 @@ fn settings() {
set export
set fallback
set positional-arguments
set quiet-recipes
set quiet
set ignore-comments
set shell := ['a', 'b', 'c']
foo:
Expand Down Expand Up @@ -784,7 +784,7 @@ fn settings() {
"fallback": true,
"ignore_comments": true,
"positional_arguments": true,
"quiet_recipes": true,
"quiet": true,
"shell": {
"arguments": ["b", "c"],
"command": "a",
Expand Down Expand Up @@ -832,7 +832,7 @@ fn shebang() {
"fallback": false,
"ignore_comments": false,
"positional_arguments": false,
"quiet_recipes": false,
"quiet": false,
"shell": null,
"tempdir": null,
"windows_powershell": false,
Expand Down Expand Up @@ -874,7 +874,7 @@ fn simple() {
"fallback": false,
"ignore_comments": false,
"positional_arguments": false,
"quiet_recipes": false,
"quiet": false,
"shell": null,
"tempdir": null,
"windows_powershell": false,
Expand Down Expand Up @@ -918,7 +918,7 @@ fn attribute() {
"export": false,
"fallback": false,
"positional_arguments": false,
"quiet_recipes": false,
"quiet": false,
"shell": null,
"tempdir" : null,
"ignore_comments": false,
Expand Down

0 comments on commit 01c030d

Please sign in to comment.