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

Extend Persistent*Run behavior to allow multiple hooks throughout the execution chain #1142

Closed
wants to merge 6 commits into from

Conversation

bartdeboer
Copy link

Supersedes: PR #1123
Resolves: #252, #219
Related PR's: #714, #220

  • Introduces On*Run() methods to register hooks
  • Introduces OnPersistent*Run() methods to register hooks that are always executed (childs not overriding parents).
  • Allows to register multiple *Run hooks
  • Keeps current Persistent*Run behavior unaffected (childs still override parents when set as a property)
  • Introduces EnablePersistentRunOverride option to control if child Persistent*Run hooks should override their parent's hooks

@bartdeboer
Copy link
Author

Alternatively I've created a package Cobrahooks that attempts to introduce the functionality from this PR as close as possible.

@github-actions
Copy link

github-actions bot commented Sep 7, 2020

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

@github-actions github-actions bot closed this Mar 31, 2022
hoshsadiq pushed a commit to zulucmd/zulu that referenced this pull request Dec 31, 2022
Supersedes: PR #1123
Resolves: #252, #219
Related PR's: #714, #220

- Introduces On*Run() methods to register hooks
- Introduces OnPersistent*Run() methods to register hooks that are
  always executed (childs not overriding parents).
- Allows to register multiple *Run hooks
- Keeps current Persistent*Run behavior unaffected (childs still
  override parents when set as a property)
- Introduces EnablePersistentRunOverride option to control if child
  Persistent*Run hooks should override their parent's hooks

Merge spf13/cobra#1142
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.

PersistentPreRun only allowed once
1 participant