Hide recipes with [private]
attribute (#1422)
This commit is contained in:
parent
6ff18af48f
commit
2b46af1cae
15
README.md
15
README.md
@ -2007,6 +2007,21 @@ $ just --summary
|
|||||||
test
|
test
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The `[private]` attribute<sup>master</sup> may also be used to hide recipes without needing to change the name:
|
||||||
|
|
||||||
|
```make
|
||||||
|
[private]
|
||||||
|
foo:
|
||||||
|
|
||||||
|
bar:
|
||||||
|
```
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ just --list
|
||||||
|
Available recipes:
|
||||||
|
bar
|
||||||
|
```
|
||||||
|
|
||||||
This is useful for helper recipes which are only meant to be used as dependencies of other recipes.
|
This is useful for helper recipes which are only meant to be used as dependencies of other recipes.
|
||||||
|
|
||||||
### Quiet Recipes
|
### Quiet Recipes
|
||||||
|
@ -10,6 +10,7 @@ pub(crate) enum Attribute {
|
|||||||
Macos,
|
Macos,
|
||||||
NoCd,
|
NoCd,
|
||||||
NoExitMessage,
|
NoExitMessage,
|
||||||
|
Private,
|
||||||
Unix,
|
Unix,
|
||||||
Windows,
|
Windows,
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ impl<'src, D> Recipe<'src, D> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn public(&self) -> bool {
|
pub(crate) fn public(&self) -> bool {
|
||||||
!self.private
|
!self.private && !self.attributes.contains(&Attribute::Private)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn change_directory(&self) -> bool {
|
pub(crate) fn change_directory(&self) -> bool {
|
||||||
|
@ -65,6 +65,7 @@ mod no_exit_message;
|
|||||||
mod os_attributes;
|
mod os_attributes;
|
||||||
mod parser;
|
mod parser;
|
||||||
mod positional_arguments;
|
mod positional_arguments;
|
||||||
|
mod private;
|
||||||
mod quiet;
|
mod quiet;
|
||||||
mod quote;
|
mod quote;
|
||||||
mod readme;
|
mod readme;
|
||||||
|
19
tests/private.rs
Normal file
19
tests/private.rs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn attribute() {
|
||||||
|
Test::new()
|
||||||
|
.justfile(
|
||||||
|
"
|
||||||
|
[private]
|
||||||
|
foo:
|
||||||
|
",
|
||||||
|
)
|
||||||
|
.args(&["--list"])
|
||||||
|
.stdout(
|
||||||
|
"
|
||||||
|
Available recipes:
|
||||||
|
",
|
||||||
|
)
|
||||||
|
.run();
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user