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

Command hierarchy middleware #764

Closed
llonchj opened this issue Oct 15, 2018 · 3 comments
Closed

Command hierarchy middleware #764

llonchj opened this issue Oct 15, 2018 · 3 comments

Comments

@llonchj
Copy link

llonchj commented Oct 15, 2018

I have the following command hierarchy:

rootCmd (meant to initialize logging)
+--subCmd (meant to initialize a external service i.e. Redis)
   +--subSubCmd (meant to perform an action)

I would like the execution of subSubCmd to run a middleware pattern to setup and teardown each inheritance level.

The current PersistentPreRun and PersistentPostRun does something similar but stops at the first command with the function and also interates from parent.

Is there an existing mechanism in cobra to do that? If not, do you think it will be an interesting feature?

@llonchj
Copy link
Author

llonchj commented Oct 15, 2018

Related to #252 and and fixed in PR 714

@github-actions
Copy link

github-actions bot commented Apr 8, 2020

This issue is being marked as stale due to a long period of inactivity

@johnSchnake
Copy link
Collaborator

That PR did get closed from inactivity but #252 is still open and @poy did put up a PR for it which gated the behavior.

I'm going to close this issue as duplicate as a result; please watch the other issue for a resolution/discussion.

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

No branches or pull requests

2 participants