File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -73,8 +73,7 @@ func Name(obj any) string {
73
73
return commandName
74
74
}
75
75
76
- func Main (cmd * cobra.Command ) {
77
- ctx := SetupSignalContext ()
76
+ func MainCtx (ctx context.Context , cmd * cobra.Command ) {
78
77
if err := cmd .ExecuteContext (ctx ); err != nil {
79
78
if strings .EqualFold ("interrupt" , err .Error ()) || errors .Is (err , context .Canceled ) {
80
79
os .Exit (1 )
@@ -83,6 +82,10 @@ func Main(cmd *cobra.Command) {
83
82
}
84
83
}
85
84
85
+ func Main (cmd * cobra.Command ) {
86
+ MainCtx (SetupSignalContext (), cmd )
87
+ }
88
+
86
89
// Command populates a cobra.Command object by extracting args from struct tags of the
87
90
// Runnable obj passed. The Run method is assigned to the RunE of the command.
88
91
// children should be either Runnable or *cobra.Command
You can’t perform that action at this time.
0 commit comments