github.com/taubyte/tau-cli@v0.1.13-0.20240326000942-487f0d57edfc/cli/common/types.go (about)

     1  package common
     2  
     3  import (
     4  	"github.com/urfave/cli/v2"
     5  )
     6  
     7  type Option func(Linker)
     8  
     9  type Command interface {
    10  	Raw() *cli.Command
    11  	Parent() *cli.Command
    12  	Options() []Option
    13  	Initialize(parentCommand *cli.Command, baseCommand *cli.Command, baseOps []Option) *cli.Command
    14  }
    15  
    16  type Basic interface {
    17  	New() Command
    18  	Edit() Command
    19  	Delete() Command
    20  	Query() Command
    21  	List() Command
    22  	Select() Command
    23  	Clone() Command
    24  	Push() Command
    25  	Pull() Command
    26  	Checkout() Command
    27  	Import() Command
    28  
    29  	// Sets the following in the command if not already set:
    30  	// Name
    31  	// Aliases
    32  	// Also runs the options provided
    33  	Base() (*cli.Command, []Option)
    34  }
    35  
    36  type Linker interface {
    37  	Command
    38  	Before() BeforeHandler
    39  	Flags() FlagHandler
    40  }
    41  
    42  type BeforeHandler interface {
    43  	Shift(method cli.BeforeFunc)
    44  	Push(method cli.BeforeFunc)
    45  }
    46  
    47  type FlagHandler interface {
    48  	Shift(flags ...cli.Flag)
    49  	Push(flags ...cli.Flag)
    50  }