1
1
mirror of https://github.com/casey/just.git synced 2024-11-22 18:34:06 +03:00

Ignore [private] recipes in just --list (#1816)

This commit is contained in:
crdx 2024-01-09 08:07:43 +00:00 committed by GitHub
parent cf57613da7
commit 541e78104c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 34 additions and 3 deletions

View File

@ -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 {

View File

@ -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)
}

View File

@ -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;
}

View File

@ -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()