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

Missing support for removing group #1911

Open
valllabh opened this issue Feb 15, 2023 · 3 comments
Open

Missing support for removing group #1911

valllabh opened this issue Feb 15, 2023 · 3 comments
Labels
area/cobra-command Core `cobra.Command` implementations kind/feature A feature request for cobra; new or enhanced behavior

Comments

@valllabh
Copy link

valllabh commented Feb 15, 2023

cobra/command.go

Line 1310 in b4f979a

func (c *Command) AddGroup(groups ...*Group) {

We can see there is a support to AddGroup but there is no support for RemoveGroup
Where as we also see support for AddCommand and RemoveCommand

@valllabh valllabh changed the title no support for removing group Missing support for removing group Feb 15, 2023
valllabh added a commit to valllabh/cobra that referenced this issue Feb 15, 2023
@marckhouzam
Copy link
Collaborator

This seems to make sense, but due completeness can you give an example of where this would be needed?

@valllabh
Copy link
Author

valllabh commented Feb 15, 2023

Sure @marckhouzam

Usecase:
Consider there is a Cobra based tool that is already written and maintained by the community and developer needs to use it as library to add/remove more functionalities. In such cases developer should be able to modify (add, remove) Groups just like commands.

Example:
I am facing such issue right now, where I am wrapping restish with some more functionalities.
Forking restish will lead to unnecessary maintenance.
I need to add extra functionality and make the tool more simple for the my use case .
It will also not make sense to move that code into restish.

restish is built using cobra and it has exposed root command for such use cases.
Where developer can add/remove more commands and groups. But cobra do not support removal of groups.

@marckhouzam marckhouzam added kind/feature A feature request for cobra; new or enhanced behavior area/cobra-command Core `cobra.Command` implementations labels Feb 15, 2023
@JunNishimura
Copy link
Contributor

@marckhouzam @valllabh

Sorry, I missed that a PR(#1912) has already been submitted regarding this Issue.
However, it appears that a PR has not been updated, so I am submitting new PR(#1997) regarding this issue just in case.

I would appreciate it if you check the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cobra-command Core `cobra.Command` implementations kind/feature A feature request for cobra; new or enhanced behavior
Projects
None yet
Development

No branches or pull requests

3 participants