You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@nejtr0n What exactly are you trying to achieve ? when calling rootCmd.Run(ctx, args) you can pass in a ctx of your choice with whatever values you define. All subcmds will have a context with parent context set to that so you should have able to retrieve said values. Do you mean you want to pass in a new context to the Action function for the command based on what you set in Before ? I hadnt really thought about that use case. If you can give me a sample of Before/Action functions of your older code I can see what can be done.
Checklist
What problem does this solve?
In old versions we could add context fields in Before function like this
It's useful for example for passing logger through all commands.
Solution description
Add some middleware layer to command with signature
where we could modify passing ctx
Describe alternatives you've considered
Return back Context field to command
The text was updated successfully, but these errors were encountered: