github.com/toolvox/utilgo@v0.0.5/pkg/cli/cmds/cmdlet.go (about)

     1  package cmds
     2  
     3  // Cmdlet is an interface that has one function Run which takes a slice of action args and returns an [error].
     4  //
     5  // The actions are the program args with all -flags parsed and removed.
     6  type Cmdlet interface {
     7  	Run(actions []string) error
     8  }
     9  
    10  // CmdFunc wraps a function with the correct type to a [Cmdlet].
    11  type CmdFunc func(args []string) error
    12  
    13  // Run invokes the [CmdFunc].
    14  func (c CmdFunc) Run(actions []string) error { return c(actions) }