From 7d02a29f59f58c5383dc6cc09b8969e76e6e5f94 Mon Sep 17 00:00:00 2001 From: Liam Date: Mon, 9 Mar 2026 23:28:44 -0400 Subject: [PATCH 01/10] Add initial work --- completions/just.bash | 6 +++- completions/just.elvish | 1 + completions/just.fish | 1 + completions/just.powershell | 1 + completions/just.zsh | 1 + src/config.rs | 15 ++++++++++ src/subcommand.rs | 27 ++++++++++++----- tests/groups.rs | 58 +++++++++++++++++++++++++++++++++++++ 8 files changed, 102 insertions(+), 8 deletions(-) diff --git a/completions/just.bash b/completions/just.bash index 67f058d8f8..7d7db2e205 100644 --- a/completions/just.bash +++ b/completions/just.bash @@ -30,7 +30,7 @@ _just() { case "${cmd}" in just) - opts="-E -n -g -f -q -u -v -d -c -e -l -s -h -V --alias-style --ceiling --check --chooser --clear-shell-args --color --command-color --cygpath --dotenv-filename --dotenv-path --dry-run --dump-format --explain --global-justfile --highlight --justfile --list-heading --list-prefix --list-submodules --no-aliases --no-deps --no-dotenv --no-highlight --one --quiet --allow-missing --set --shell --shell-arg --shell-command --tempdir --timestamp --timestamp-format --unsorted --unstable --verbose --working-directory --yes --changelog --choose --command --completions --dump --edit --evaluate --fmt --groups --init --list --man --request --show --summary --usage --variables --help --version [ARGUMENTS]..." + opts="-E -n -g -f -q -u -v -d -c -e -l -s -h -V --alias-style --ceiling --check --chooser --clear-shell-args --color --command-color --cygpath --dotenv-filename --dotenv-path --dry-run --dump-format --explain --global-justfile --highlight --justfile --list-heading --list-prefix --list-submodules --group --no-aliases --no-deps --no-dotenv --no-highlight --one --quiet --allow-missing --set --shell --shell-arg --shell-command --tempdir --timestamp --timestamp-format --unsorted --unstable --verbose --working-directory --yes --changelog --choose --command --completions --dump --edit --evaluate --fmt --groups --init --list --man --request --show --summary --usage --variables --help --version [ARGUMENTS]..." if [[ ${cur} == -* ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -108,6 +108,10 @@ _just() { COMPREPLY=($(compgen -f "${cur}")) return 0 ;; + --group) + COMPREPLY=($(compgen -f "${cur}")) + return 0 + ;; --set) COMPREPLY=($(compgen -f "${cur}")) return 0 diff --git a/completions/just.elvish b/completions/just.elvish index 5d21051c05..2dcaf5290f 100644 --- a/completions/just.elvish +++ b/completions/just.elvish @@ -31,6 +31,7 @@ set edit:completion:arg-completer[just] = {|@words| cand --justfile 'Use as justfile' cand --list-heading 'Print before list' cand --list-prefix 'Print before each list item' + cand --group 'Only list recipes in ' cand --set 'Override with ' cand --shell 'Invoke to run recipes' cand --shell-arg 'Invoke shell with as an argument' diff --git a/completions/just.fish b/completions/just.fish index 9c06a1f3bd..ad44a02bb3 100644 --- a/completions/just.fish +++ b/completions/just.fish @@ -35,6 +35,7 @@ just\t''" complete -c just -s f -l justfile -d 'Use as justfile' -r -F complete -c just -l list-heading -d 'Print before list' -r complete -c just -l list-prefix -d 'Print before each list item' -r +complete -c just -l group -d 'Only list recipes in ' -r complete -c just -l set -d 'Override with ' -r complete -c just -l shell -d 'Invoke to run recipes' -r complete -c just -l shell-arg -d 'Invoke shell with as an argument' -r diff --git a/completions/just.powershell b/completions/just.powershell index 1b7e12fdd9..a90e93a684 100644 --- a/completions/just.powershell +++ b/completions/just.powershell @@ -34,6 +34,7 @@ Register-ArgumentCompleter -Native -CommandName 'just' -ScriptBlock { [CompletionResult]::new('--justfile', '--justfile', [CompletionResultType]::ParameterName, 'Use as justfile') [CompletionResult]::new('--list-heading', '--list-heading', [CompletionResultType]::ParameterName, 'Print before list') [CompletionResult]::new('--list-prefix', '--list-prefix', [CompletionResultType]::ParameterName, 'Print before each list item') + [CompletionResult]::new('--group', '--group', [CompletionResultType]::ParameterName, 'Only list recipes in ') [CompletionResult]::new('--set', '--set', [CompletionResultType]::ParameterName, 'Override with ') [CompletionResult]::new('--shell', '--shell', [CompletionResultType]::ParameterName, 'Invoke to run recipes') [CompletionResult]::new('--shell-arg', '--shell-arg', [CompletionResultType]::ParameterName, 'Invoke shell with as an argument') diff --git a/completions/just.zsh b/completions/just.zsh index 58c8a7a469..6b20179009 100644 --- a/completions/just.zsh +++ b/completions/just.zsh @@ -29,6 +29,7 @@ _just() { '--justfile=[Use as justfile]: :_files' \ '--list-heading=[Print before list]:TEXT:_default' \ '--list-prefix=[Print before each list item]:TEXT:_default' \ +'*--group=[Only list recipes in ]:GROUP:_default' \ '*--set=[Override with ]: :(_just_variables)' \ '--shell=[Invoke to run recipes]: :_default' \ '*--shell-arg=[Invoke shell with as an argument]: :_default' \ diff --git a/src/config.rs b/src/config.rs index b2a49d4e7b..05915b28ec 100644 --- a/src/config.rs +++ b/src/config.rs @@ -26,6 +26,7 @@ pub(crate) struct Config { pub(crate) explain: bool, pub(crate) highlight: bool, pub(crate) invocation_directory: PathBuf, + pub(crate) list_groups: Vec, pub(crate) list_heading: String, pub(crate) list_prefix: String, pub(crate) list_submodules: bool, @@ -110,6 +111,7 @@ mod arg { pub(crate) const GLOBAL_JUSTFILE: &str = "GLOBAL-JUSTFILE"; pub(crate) const HIGHLIGHT: &str = "HIGHLIGHT"; pub(crate) const JUSTFILE: &str = "JUSTFILE"; + pub(crate) const LIST_GROUP: &str = "LIST-GROUP"; pub(crate) const LIST_HEADING: &str = "LIST-HEADING"; pub(crate) const LIST_PREFIX: &str = "LIST-PREFIX"; pub(crate) const LIST_SUBMODULES: &str = "LIST-SUBMODULES"; @@ -316,6 +318,15 @@ impl Config { .action(ArgAction::SetTrue) .requires(cmd::LIST), ) + .arg( + Arg::new(arg::LIST_GROUP) + .long("group") + .env("JUST_GROUP") + .help("Only list recipes in ") + .value_name("GROUP") + .action(ArgAction::Append) + .requires(cmd::LIST), + ) .arg( Arg::new(arg::NO_ALIASES) .long("no-aliases") @@ -827,6 +838,10 @@ impl Config { explain, highlight: !matches.get_flag(arg::NO_HIGHLIGHT), invocation_directory: env::current_dir().context(config_error::CurrentDirContext)?, + list_groups: matches + .get_many::(arg::LIST_GROUP) + .map(|s| s.map(Into::into).collect()) + .unwrap_or_default(), list_heading: matches.get_one::(arg::LIST_HEADING).unwrap().into(), list_prefix: matches.get_one::(arg::LIST_PREFIX).unwrap().into(), list_submodules: matches.get_flag(arg::LIST_SUBMODULES), diff --git a/src/subcommand.rs b/src/subcommand.rs index b01f807383..a6b4189207 100644 --- a/src/subcommand.rs +++ b/src/subcommand.rs @@ -634,17 +634,30 @@ impl Subcommand { groups }; - let mut ordered_groups = module - .public_groups(config) - .into_iter() - .map(Some) - .collect::>>(); + let mut ordered_groups = if config.list_groups.is_empty() { + module + .public_groups(config) + .into_iter() + .map(Some) + .collect::>>() + } else { + config + .list_groups + .iter() + .cloned() + .map(Some) + .collect::>>() + }; - if recipe_groups.contains_key(&None) || submodule_groups.contains_key(&None) { + if config.list_groups.is_empty() + && (recipe_groups.contains_key(&None) || submodule_groups.contains_key(&None)) + { ordered_groups.insert(0, None); } - let no_groups = ordered_groups.len() == 1 && ordered_groups.first() == Some(&None); + let no_groups = config.list_groups.is_empty() + && ordered_groups.len() == 1 + && ordered_groups.first() == Some(&None); let groups_count = if no_groups { 0 } else { ordered_groups.len() }; diff --git a/tests/groups.rs b/tests/groups.rs index b5f91a7fa8..58d3224d44 100644 --- a/tests/groups.rs +++ b/tests/groups.rs @@ -1,5 +1,63 @@ use super::*; +#[test] +fn list_group() { + Test::new() + .justfile( + " + [group('alpha')] + a: + [group('alpha')] + [group('beta')] + b: + c: + [group('beta')] + d: + ", + ) + .args(["--list", "--group", "alpha"]) + .stdout( + " + Available recipes: + [alpha] + a + b + ", + ) + .success(); +} + +#[test] +fn list_multiple_groups() { + Test::new() + .justfile( + " + [group('alpha')] + a: + [group('alpha')] + [group('beta')] + b: + c: + [group('beta')] + d: + ", + ) + .args(["--list", "--group", "alpha", "--group", "beta"]) + .stdout( + " + Available recipes: + [alpha] + a + b + + [beta] + b + d + ", + ) + .success(); +} + #[test] fn list_with_groups() { Test::new() From 7401dabed7efb4e2f169d3ba7aa55f2f6bec6620 Mon Sep 17 00:00:00 2001 From: Liam Date: Tue, 10 Mar 2026 10:37:34 -0400 Subject: [PATCH 02/10] Error on unknown groups --- src/error.rs | 6 ++++++ src/subcommand.rs | 19 ++++++++++++++++--- tests/groups.rs | 14 ++++++++++++++ 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/src/error.rs b/src/error.rs index 81a6ef5f9e..0393fd28b9 100644 --- a/src/error.rs +++ b/src/error.rs @@ -232,6 +232,9 @@ pub(crate) enum Error<'src> { UnknownOverrides { overrides: Vec, }, + UnknownGroup { + group: String, + }, UnknownRecipe { recipe: String, suggestion: Option>, @@ -770,6 +773,9 @@ impl ColorDisplay for Error<'_> { "{count} {overrides} overridden on the command line but not present in justfile", )?; } + UnknownGroup { group } => { + write!(f, "Justfile does not contain group `{group}`")?; + } UnknownRecipe { recipe, suggestion } => { write!(f, "Justfile does not contain recipe `{recipe}`")?; if let Some(suggestion) = suggestion { diff --git a/src/subcommand.rs b/src/subcommand.rs index a6b4189207..232d3b127a 100644 --- a/src/subcommand.rs +++ b/src/subcommand.rs @@ -478,12 +478,12 @@ impl Subcommand { })?; } - Self::list_module(config, module, 0); + Self::list_module(config, module, 0)?; Ok(()) } - fn list_module(config: &Config, module: &Justfile, depth: usize) { + fn list_module(config: &Config, module: &Justfile, depth: usize) -> RunResult<'static> { fn print_doc_and_aliases( config: &Config, name: &str, @@ -597,6 +597,17 @@ impl Subcommand { let list_prefix = config.list_prefix.repeat(depth + 1); + if depth == 0 && !config.list_groups.is_empty() { + let all_groups = module.public_groups(config); + for group in &config.list_groups { + if !all_groups.contains(group) { + return Err(Error::UnknownGroup { + group: group.clone(), + }); + } + } + } + if depth == 0 { print!("{}", config.list_heading); } @@ -733,7 +744,7 @@ impl Subcommand { } println!("{list_prefix}{}:", submodule.name()); - Self::list_module(config, submodule, depth + 1); + Self::list_module(config, submodule, depth + 1)?; } else { print!("{list_prefix}{} ...", submodule.name()); print_doc_and_aliases( @@ -748,6 +759,8 @@ impl Subcommand { } } } + + Ok(()) } fn show<'src>(config: &Config, module: &Justfile<'src>, path: &ModulePath) -> RunResult<'src> { diff --git a/tests/groups.rs b/tests/groups.rs index 58d3224d44..ded53c9ab7 100644 --- a/tests/groups.rs +++ b/tests/groups.rs @@ -1,5 +1,19 @@ use super::*; +#[test] +fn list_group_unknown() { + Test::new() + .justfile( + " + [group('foo')] + a: + ", + ) + .args(["--list", "--group", "bar"]) + .stderr("error: Justfile does not contain group `bar`\n") + .failure(); +} + #[test] fn list_group() { Test::new() From 2a254c7d791ebee1e0644e83b2a60b0d2c0b874e Mon Sep 17 00:00:00 2001 From: Liam Date: Tue, 10 Mar 2026 10:41:35 -0400 Subject: [PATCH 03/10] Rename groups --- src/config.rs | 11 +++++------ src/subcommand.rs | 12 ++++++------ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/config.rs b/src/config.rs index 05915b28ec..81869b0e00 100644 --- a/src/config.rs +++ b/src/config.rs @@ -26,7 +26,7 @@ pub(crate) struct Config { pub(crate) explain: bool, pub(crate) highlight: bool, pub(crate) invocation_directory: PathBuf, - pub(crate) list_groups: Vec, + pub(crate) groups: Vec, pub(crate) list_heading: String, pub(crate) list_prefix: String, pub(crate) list_submodules: bool, @@ -111,7 +111,7 @@ mod arg { pub(crate) const GLOBAL_JUSTFILE: &str = "GLOBAL-JUSTFILE"; pub(crate) const HIGHLIGHT: &str = "HIGHLIGHT"; pub(crate) const JUSTFILE: &str = "JUSTFILE"; - pub(crate) const LIST_GROUP: &str = "LIST-GROUP"; + pub(crate) const GROUP: &str = "GROUP"; pub(crate) const LIST_HEADING: &str = "LIST-HEADING"; pub(crate) const LIST_PREFIX: &str = "LIST-PREFIX"; pub(crate) const LIST_SUBMODULES: &str = "LIST-SUBMODULES"; @@ -319,11 +319,10 @@ impl Config { .requires(cmd::LIST), ) .arg( - Arg::new(arg::LIST_GROUP) + Arg::new(arg::GROUP) .long("group") .env("JUST_GROUP") .help("Only list recipes in ") - .value_name("GROUP") .action(ArgAction::Append) .requires(cmd::LIST), ) @@ -838,8 +837,8 @@ impl Config { explain, highlight: !matches.get_flag(arg::NO_HIGHLIGHT), invocation_directory: env::current_dir().context(config_error::CurrentDirContext)?, - list_groups: matches - .get_many::(arg::LIST_GROUP) + groups: matches + .get_many::(arg::GROUP) .map(|s| s.map(Into::into).collect()) .unwrap_or_default(), list_heading: matches.get_one::(arg::LIST_HEADING).unwrap().into(), diff --git a/src/subcommand.rs b/src/subcommand.rs index 232d3b127a..fc5b491b82 100644 --- a/src/subcommand.rs +++ b/src/subcommand.rs @@ -597,9 +597,9 @@ impl Subcommand { let list_prefix = config.list_prefix.repeat(depth + 1); - if depth == 0 && !config.list_groups.is_empty() { + if depth == 0 && !config.groups.is_empty() { let all_groups = module.public_groups(config); - for group in &config.list_groups { + for group in &config.groups { if !all_groups.contains(group) { return Err(Error::UnknownGroup { group: group.clone(), @@ -645,7 +645,7 @@ impl Subcommand { groups }; - let mut ordered_groups = if config.list_groups.is_empty() { + let mut ordered_groups = if config.groups.is_empty() { module .public_groups(config) .into_iter() @@ -653,20 +653,20 @@ impl Subcommand { .collect::>>() } else { config - .list_groups + .groups .iter() .cloned() .map(Some) .collect::>>() }; - if config.list_groups.is_empty() + if config.groups.is_empty() && (recipe_groups.contains_key(&None) || submodule_groups.contains_key(&None)) { ordered_groups.insert(0, None); } - let no_groups = config.list_groups.is_empty() + let no_groups = config.groups.is_empty() && ordered_groups.len() == 1 && ordered_groups.first() == Some(&None); From b08a0a258633366279aeb6bd7be2a7b2315ed4fc Mon Sep 17 00:00:00 2001 From: Liam Date: Tue, 10 Mar 2026 11:06:16 -0400 Subject: [PATCH 04/10] Fix completion --- completions/just.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/completions/just.zsh b/completions/just.zsh index 6b20179009..776d21f7ba 100644 --- a/completions/just.zsh +++ b/completions/just.zsh @@ -29,7 +29,7 @@ _just() { '--justfile=[Use as justfile]: :_files' \ '--list-heading=[Print before list]:TEXT:_default' \ '--list-prefix=[Print before each list item]:TEXT:_default' \ -'*--group=[Only list recipes in ]:GROUP:_default' \ +'*--group=[Only list recipes in ]: :_default' \ '*--set=[Override with ]: :(_just_variables)' \ '--shell=[Invoke to run recipes]: :_default' \ '*--shell-arg=[Invoke shell with as an argument]: :_default' \ From a760b5aec91310b4a85b7a5b76a8caabc1d2ea9f Mon Sep 17 00:00:00 2001 From: Liam Date: Tue, 10 Mar 2026 11:08:05 -0400 Subject: [PATCH 05/10] Appease clippy --- src/config.rs | 2 +- src/error.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/config.rs b/src/config.rs index 81869b0e00..228b255e69 100644 --- a/src/config.rs +++ b/src/config.rs @@ -24,9 +24,9 @@ pub(crate) struct Config { pub(crate) dry_run: bool, pub(crate) dump_format: DumpFormat, pub(crate) explain: bool, + pub(crate) groups: Vec, pub(crate) highlight: bool, pub(crate) invocation_directory: PathBuf, - pub(crate) groups: Vec, pub(crate) list_heading: String, pub(crate) list_prefix: String, pub(crate) list_submodules: bool, diff --git a/src/error.rs b/src/error.rs index 0393fd28b9..9e9e40b2ab 100644 --- a/src/error.rs +++ b/src/error.rs @@ -225,6 +225,9 @@ pub(crate) enum Error<'src> { recipe: &'src str, line_number: Option, }, + UnknownGroup { + group: String, + }, UnknownOption { recipe: &'src str, option: Switch, @@ -232,9 +235,6 @@ pub(crate) enum Error<'src> { UnknownOverrides { overrides: Vec, }, - UnknownGroup { - group: String, - }, UnknownRecipe { recipe: String, suggestion: Option>, From d89c2d058130a2be91c03deae9360165ede5d23e Mon Sep 17 00:00:00 2001 From: Liam Date: Tue, 10 Mar 2026 11:15:22 -0400 Subject: [PATCH 06/10] Add third group to multiple group test --- tests/groups.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/groups.rs b/tests/groups.rs index ded53c9ab7..8d27ba84c3 100644 --- a/tests/groups.rs +++ b/tests/groups.rs @@ -54,9 +54,13 @@ fn list_multiple_groups() { c: [group('beta')] d: + [group('gamma')] + e: ", ) - .args(["--list", "--group", "alpha", "--group", "beta"]) + .args([ + "--list", "--group", "alpha", "--group", "beta", "--group", "gamma", + ]) .stdout( " Available recipes: @@ -67,6 +71,9 @@ fn list_multiple_groups() { [beta] b d + + [gamma] + e ", ) .success(); From 0232ab1f43e93d20876aa074e163f5da211435c8 Mon Sep 17 00:00:00 2001 From: Liam Date: Tue, 10 Mar 2026 16:17:01 -0400 Subject: [PATCH 07/10] Pass groups to `list_module` as parameter instead of checking depth --- src/subcommand.rs | 55 +++++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/src/subcommand.rs b/src/subcommand.rs index fc5b491b82..85b901ec60 100644 --- a/src/subcommand.rs +++ b/src/subcommand.rs @@ -478,12 +478,17 @@ impl Subcommand { })?; } - Self::list_module(config, module, 0)?; + Self::list_module(config, module, 0, &config.groups)?; Ok(()) } - fn list_module(config: &Config, module: &Justfile, depth: usize) -> RunResult<'static> { + fn list_module( + config: &Config, + module: &Justfile, + depth: usize, + groups: &[String], + ) -> RunResult<'static> { fn print_doc_and_aliases( config: &Config, name: &str, @@ -597,9 +602,9 @@ impl Subcommand { let list_prefix = config.list_prefix.repeat(depth + 1); - if depth == 0 && !config.groups.is_empty() { + if !groups.is_empty() { let all_groups = module.public_groups(config); - for group in &config.groups { + for group in groups { if !all_groups.contains(group) { return Err(Error::UnknownGroup { group: group.clone(), @@ -613,62 +618,60 @@ impl Subcommand { } let recipe_groups = { - let mut groups = BTreeMap::, Vec<&Recipe>>::new(); + let mut recipe_groups = BTreeMap::, Vec<&Recipe>>::new(); for recipe in module.public_recipes(config) { - let recipe_groups = recipe.groups(); - if recipe_groups.is_empty() { - groups.entry(None).or_default().push(recipe); + let recipe_groups_list = recipe.groups(); + if recipe_groups_list.is_empty() { + recipe_groups.entry(None).or_default().push(recipe); } else { - for group in recipe_groups { - groups.entry(Some(group)).or_default().push(recipe); + for group in recipe_groups_list { + recipe_groups.entry(Some(group)).or_default().push(recipe); } } } - groups + recipe_groups }; let submodule_groups = { - let mut groups = BTreeMap::, Vec<&Justfile>>::new(); + let mut submodule_groups = BTreeMap::, Vec<&Justfile>>::new(); for submodule in module.public_modules(config) { - let submodule_groups = submodule.groups(); - if submodule_groups.is_empty() { - groups.entry(None).or_default().push(submodule); + let submodule_groups_list = submodule.groups(); + if submodule_groups_list.is_empty() { + submodule_groups.entry(None).or_default().push(submodule); } else { - for group in submodule_groups { - groups + for group in submodule_groups_list { + submodule_groups .entry(Some(group.to_string())) .or_default() .push(submodule); } } } - groups + submodule_groups }; - let mut ordered_groups = if config.groups.is_empty() { + let mut ordered_groups = if groups.is_empty() { module .public_groups(config) .into_iter() .map(Some) .collect::>>() } else { - config - .groups + groups .iter() .cloned() .map(Some) .collect::>>() }; - if config.groups.is_empty() + if groups.is_empty() && (recipe_groups.contains_key(&None) || submodule_groups.contains_key(&None)) { ordered_groups.insert(0, None); } - let no_groups = config.groups.is_empty() - && ordered_groups.len() == 1 - && ordered_groups.first() == Some(&None); + let no_groups = + groups.is_empty() && ordered_groups.len() == 1 && ordered_groups.first() == Some(&None); let groups_count = if no_groups { 0 } else { ordered_groups.len() }; @@ -744,7 +747,7 @@ impl Subcommand { } println!("{list_prefix}{}:", submodule.name()); - Self::list_module(config, submodule, depth + 1)?; + Self::list_module(config, submodule, depth + 1, &[])?; } else { print!("{list_prefix}{} ...", submodule.name()); print_doc_and_aliases( From 4e3a93d9159d05e61b7d87fcabfc0f009abe931c Mon Sep 17 00:00:00 2001 From: Liam Date: Tue, 10 Mar 2026 17:37:41 -0400 Subject: [PATCH 08/10] Add test with submodules --- tests/groups.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/groups.rs b/tests/groups.rs index 8d27ba84c3..dcdf332072 100644 --- a/tests/groups.rs +++ b/tests/groups.rs @@ -361,3 +361,28 @@ fn list_groups_private() { ) .success(); } + +#[test] +fn list_group_with_submodules() { + Test::new() + .justfile( + " + [group('foo')] + a: + + b: + + mod bar + ", + ) + .write("bar.just", "c:\nd:") + .args(["--list", "--group", "foo", "--list-submodules"]) + .stdout( + " + Available recipes: + [foo] + a + ", + ) + .success(); +} From 2b29da6de25e659eae85febca4986ad453cced0f Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Tue, 10 Mar 2026 15:26:06 -0700 Subject: [PATCH 09/10] Sort list_module arguments --- src/subcommand.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/subcommand.rs b/src/subcommand.rs index 85b901ec60..9a6579cf31 100644 --- a/src/subcommand.rs +++ b/src/subcommand.rs @@ -478,16 +478,16 @@ impl Subcommand { })?; } - Self::list_module(config, module, 0, &config.groups)?; + Self::list_module(config, 0, &config.groups, module)?; Ok(()) } fn list_module( config: &Config, - module: &Justfile, depth: usize, groups: &[String], + module: &Justfile, ) -> RunResult<'static> { fn print_doc_and_aliases( config: &Config, @@ -747,7 +747,7 @@ impl Subcommand { } println!("{list_prefix}{}:", submodule.name()); - Self::list_module(config, submodule, depth + 1, &[])?; + Self::list_module(config, depth + 1, &[], submodule)?; } else { print!("{list_prefix}{} ...", submodule.name()); print_doc_and_aliases( From 6c9103e90ae6ef446d0b2c1732ecf8ac781bc3b8 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Tue, 10 Mar 2026 15:26:39 -0700 Subject: [PATCH 10/10] all_groups -> public_groups --- src/subcommand.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/subcommand.rs b/src/subcommand.rs index 9a6579cf31..5c0b6e48a5 100644 --- a/src/subcommand.rs +++ b/src/subcommand.rs @@ -603,9 +603,9 @@ impl Subcommand { let list_prefix = config.list_prefix.repeat(depth + 1); if !groups.is_empty() { - let all_groups = module.public_groups(config); + let public_groups = module.public_groups(config); for group in groups { - if !all_groups.contains(group) { + if !public_groups.contains(group) { return Err(Error::UnknownGroup { group: group.clone(), });