mirror of
https://github.com/casey/just.git
synced 2024-11-23 02:44:56 +03:00
Ignore [private] recipes in just --list (#1816)
This commit is contained in:
parent
cf57613da7
commit
541e78104c
@ -468,7 +468,7 @@ impl<'src> Justfile<'src> {
|
||||
.recipes
|
||||
.values()
|
||||
.map(AsRef::as_ref)
|
||||
.filter(|recipe| recipe.public())
|
||||
.filter(|recipe| recipe.is_public())
|
||||
.collect::<Vec<&Recipe<Dependency>>>();
|
||||
|
||||
if source_order {
|
||||
|
@ -94,7 +94,7 @@ impl<'src, D> Recipe<'src, D> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn public(&self) -> bool {
|
||||
pub(crate) fn is_public(&self) -> bool {
|
||||
!self.private && !self.attributes.contains(&Attribute::Private)
|
||||
}
|
||||
|
||||
|
@ -445,7 +445,7 @@ impl Subcommand {
|
||||
let mut line_widths: BTreeMap<&str, usize> = BTreeMap::new();
|
||||
|
||||
for (name, recipe) in &justfile.recipes {
|
||||
if recipe.private {
|
||||
if !recipe.is_public() {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -685,6 +685,37 @@ fn module_paths_beginning_with_tilde_are_expanded_to_homdir() {
|
||||
.run();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn module_recipe_list_alignment_ignores_private_recipes() {
|
||||
Test::new()
|
||||
.write(
|
||||
"foo.just",
|
||||
"
|
||||
# foos
|
||||
foo:
|
||||
@echo FOO
|
||||
|
||||
[private]
|
||||
barbarbar:
|
||||
@echo BAR
|
||||
|
||||
@_bazbazbaz:
|
||||
@echo BAZ
|
||||
",
|
||||
)
|
||||
.justfile("mod foo")
|
||||
.test_round_trip(false)
|
||||
.arg("--unstable")
|
||||
.arg("--list")
|
||||
.stdout(
|
||||
"Available recipes:
|
||||
foo:
|
||||
foo # foos
|
||||
",
|
||||
)
|
||||
.run();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn recipes_with_same_name_are_both_run() {
|
||||
Test::new()
|
||||
|
Loading…
Reference in New Issue
Block a user