Skip to content

Commit

Permalink
Merge pull request #694 from rsteube/log-prerun
Browse files Browse the repository at this point in the history
traverse: added log for PreRun invocation
  • Loading branch information
rsteube authored Jan 21, 2023
2 parents c696af9 + a54ddcd commit 779a8e0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions traverse.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ func (f InFlag) Consumes(arg string) bool {
}

func traverse(c *cobra.Command, args []string) (Action, Context) {
preInvoke(c, args)
logger.Printf("traverse called for %#v with args %#v\n", c.Name(), args)
preRun(c, args)

if config.IsLenient() {
logger.Printf("allowing unknown flags")
Expand Down Expand Up @@ -175,8 +175,9 @@ func subcommand(cmd *cobra.Command, arg string) *cobra.Command {
return nil
}

func preInvoke(cmd *cobra.Command, args []string) {
func preRun(cmd *cobra.Command, args []string) {
if subCmd := subcommand(cmd, "_carapace"); subCmd != nil && subCmd.PreRun != nil {
logger.Printf("executing PreRun for %#v with args %#v", cmd.Name(), args)
subCmd.PreRun(cmd, args)
}
}

0 comments on commit 779a8e0

Please sign in to comment.