visitAll traverses all commands from the root.
(root *cobra.Command, fns ...func(*cobra.Command))
| 280 | |
| 281 | // visitAll traverses all commands from the root. |
| 282 | func visitAll(root *cobra.Command, fns ...func(*cobra.Command)) { |
| 283 | for _, cmd := range root.Commands() { |
| 284 | visitAll(cmd, fns...) |
| 285 | } |
| 286 | for _, fn := range fns { |
| 287 | fn(root) |
| 288 | } |
| 289 | } |
| 290 | |
| 291 | // The Args is handled by ValidateArgs in cobra, which does not allows a pre-hook. |
| 292 | // As a result, here we replace the existing Args validation func to a wrapper, |
no outgoing calls
searching dependent graphs…