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

Issue #219: added PreRunChain and PostRunChain hooks #220

Closed
wants to merge 3 commits into from

Commits on Jan 8, 2016

  1. Issue spf13#219: added PreRunChain and PostRunChain hooks

    PreRunChain functions run in the order of root to child.
    PostRunChain functions run in the order of child to root.
    
    The overall exection order for a command is
    PreRunChain
    PersistentPreRun
    PreRun
    Run
    PostRun
    PersistentPostRun
    PostRunChain
    
    The following gist describes the usage and functionality
    https://gist.github.com/algrebe/23cc8bf4739a129a6d0d
    algrebe committed Jan 8, 2016
    Configuration menu
    Copy the full SHA
    3dbb5be View commit details
    Browse the repository at this point in the history

Commits on Jan 13, 2016

  1. Revert "Issue spf13#219: added PreRunChain and PostRunChain hooks"

    This reverts commit 3dbb5be.
    As part of spf13#220
    PreRunChain and PostRunChain aren't required - the PersistentRun functions
    need to be modified
    algrebe committed Jan 13, 2016
    Configuration menu
    Copy the full SHA
    348f909 View commit details
    Browse the repository at this point in the history
  2. Issue spf13#219, spf13#220 PersistentFunctions can chain now

    Added the functionality for persistent functions to chain
    from root to child in the case of PersistentPreRun and
    from child to root in the case of PersistentPostRun.
    
    Added a global internal variable useChainHooks which decides
    whether to use chain feature, or use the previous logic of nearest
    defined ancestor.
    This variable useChainHooks is disabled by default in this commit.
    Developers importing the cobra package can enable it using the
    function EnableChainHooks() or disable it using DisableChainHooks().
    However, these functions may be called only once externally, preferably
    in the init of the developers main program.
    algrebe committed Jan 13, 2016
    Configuration menu
    Copy the full SHA
    76742d6 View commit details
    Browse the repository at this point in the history