Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow listing of groups (also recursively) #2298

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Spatenheinz
Copy link
Contributor

This commit is in reference to: #2195

It took me some time to implement this feature, with getting to understand the layout, trying to parameterize it to remove code duplication and going on vacation.

With this commit it should be possible to list all occurences of a group. If a submodule and a group has the same name the submodule takes precedence.

It was a nightmare to rebase this. I hope it is working as intended still (at least the tests should pass :D)

Let me know if you like it or not, and if you would like anything changed.

Copy link
Owner

@casey casey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's a good idea to overload --list NAME to mean either "list submodule with NAME" or "list group with NAME". Submodules and groups may have the same name, so this is ambiguous.

This also looks, I think, more complicated than it needs to be.

My suggestion is to add a --group flag which takes the name of a group. If `--group is passed, then the results of list should be filtered to only show recipes which match the given group name. I think the existing list code can be largely unchange, aside from the addition of a few:

if let Some(group) = &config.group {
  if !recipe.groups().contains(group) {
    continue;
  }
}

@Spatenheinz
Copy link
Contributor Author

I can look into making it less confusing (although most of what i have done is to not repeat too much code between listing of a group and of a submodule), but looking at it again it can probably be done in a better way.

Regarding the --group, either I have completely misunderstood you or you shifted your opinion since I opened #2195 :

#2195 (comment)

@casey
Copy link
Owner

casey commented Aug 5, 2024

Yah I think looking at the implementation, and how much simpler just --list --group FOO would be made me change me ind.

@casey
Copy link
Owner

casey commented Aug 5, 2024

Sorry to flip flop!

@Spatenheinz
Copy link
Contributor Author

its all good. I will try and see to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants