SIGN IN SIGN UP
spf13 / cobra UNCLAIMED

A Commander for modern Go CLI interactions

0 0 141 Go

Allow running persistent run hooks of all parents (#2044)

Currently, only one of the persistent pre-runs and post-runs is executed.
It is always the first one found in the parents chain, starting at this command.
Expected behavior is to execute all parents' persistent pre-runs and post-runs.

Dependent projects implemented various workarounds for this:
- manually building persistent hook chains (in every hook).
- applying some kind of monkey-patching on top of Cobra.

This change eliminates the necessity for such workarounds
by allowing to set a global variable EnableTraverseRunHooks.

Tickets:
- https://github.com/spf13/cobra/issues/216
- https://github.com/spf13/cobra/issues/252

Signed-off-by: Volodymyr Khoroz <volodymyr.khoroz@foundries.io>
V
vkhoroz committed
4cafa37bc4bb85633b4245aa118280fe5a9edcd5
Parent: 5c962a2
Committed by GitHub <noreply@github.com> on 10/22/2023, 12:36:12 AM