github.com/helmwave/helmwave@v0.36.4-0.20240509190856-b35563eba4c6/pkg/action/interface.go (about) 1 package action 2 3 import ( 4 "context" 5 6 "github.com/helmwave/helmwave/pkg/clictx" 7 "github.com/urfave/cli/v2" 8 ) 9 10 // Action is an interface for all actions. 11 type Action interface { 12 Run(context.Context) error 13 Cmd() *cli.Command 14 flags() []cli.Flag 15 } 16 17 // toCtx is a wrapper for urfave v2. 18 func toCtx(a func(context.Context) error) func(c *cli.Context) error { 19 return func(c *cli.Context) error { 20 ctx := clictx.CLIContextToContext(c) 21 22 return a(ctx) 23 } 24 }