-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Run Persistent*Run from root to sub #714
Conversation
Call all Persitent*Run defined from sub to root Signed-off-by: Alexander Trost <galexrt@googlemail.com>
https://github.com/spf13/cobra/pull/714/files#diff-9c42b524cb14ca001c61267826cbefb1R787 I think it makes more sense that the post hooks mirror the order of execution of the pre hooks. E.g.
https://github.com/spf13/cobra/pull/714/files#diff-9c42b524cb14ca001c61267826cbefb1R791 Is the intended behaviour to run all post run hooks? I.e. some setup is done in a pre hook and then the corresponding post hook does cleanup? We could wind up with unexpected behaviour if one of those inner post hooks return an error. Perhaps this is a separate issue, since the same could be said of the pre hooks too. |
Also, this is a breaking change, please don't merge. Perhaps it could be enabled with a FWIW, I have implemented the similar behaviour with this function:
|
Can this be merged into a new release. Otherwise, it's not really Persistent. |
Can this behavior be enabled via a flag and merged? This seems quite useful. |
Could this be merged in, it seems a 4 year old pending diff is similar |
Strictly speaking, cobra is at 0.0.3 now, so from semver perspective it's OK to break the API in 0.0.4. |
Vote for TraverseRunHooks @au-phiware |
Could this get merged in? Looking forward to this getting fixed |
If backwards compatibility is still a concern, a flag/option to enable this behavior would likely be acceptable by the community at large, unless of course most people think it's surprising that this isn't the default behavior. Not sure how one might verify that hypothesis though. |
This PR is being marked as stale due to a long period of inactivity |
Closing the PR. I have not interest in keeping the PR updated and / or have moved on to simply use workarounds for this use case. |
Resolves #252
I haven't updated the docs with the "new" behavior yet, because I want to see if this is wanted.