github.com/wawandco/oxpecker@v1.5.7-0.20210910201653-5958d4afdd89/plugins/command.go (about)

     1  package plugins
     2  
     3  import (
     4  	"context"
     5  )
     6  
     7  // Command interface for commands that the CLI provides.
     8  // a command is one of the top cli elements (build, fix, generate ...)
     9  type Command interface {
    10  	Plugin
    11  
    12  	// ParentName allows to identify subcommands and its parents.
    13  	ParentName() string
    14  
    15  	// Run the command with the passed context, root and args.
    16  	Run(context.Context, string, []string) error
    17  }
    18  
    19  // RootFinder allows some commands not to depend on the go.mod to determine the root folder,
    20  // this comes handy for commands like New and Version.
    21  type RootFinder interface {
    22  	Plugin
    23  
    24  	// FindRoot returns the path to consider as root.
    25  	FindRoot() string
    26  }
    27  
    28  // Aiaser allows commands to have aliases
    29  type Aliaser interface {
    30  	Alias() string
    31  }