cli

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2023 License: MPL-2.0 Imports: 44 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EnvLogLevel is the env var to set with the log level.
	EnvLogLevel = "NOMAD_PACK_LOG_LEVEL"

	// EnvPlain is the env var that can be set to force plain output mode.
	EnvPlain = "NOMAD_PACK_PLAIN"
)

Variables

View Source
var (
	// ErrSentinel is a sentinel value that we can return from Init to force an exit.
	ErrSentinel = errors.New("error sentinel")

	// ErrParsingArgsOrFlags should be used in the Init method of a CLI command
	// if it returns an error.
	ErrParsingArgsOrFlags = "error parsing args or flags"
)
View Source
var (
	ExposeDocs bool
)

Functions

func Commands

func Commands(
	ctx context.Context,
	opts ...Option,
) (*baseCommand, map[string]cli.CommandFactory)

Commands returns the map of commands that can be used to initialize a CLI.

func GroupedHelpFunc

func GroupedHelpFunc(f cli.HelpFunc) cli.HelpFunc

func Main

func Main(args []string) int

Main runs the CLI with the given arguments and returns the exit code. The arguments SHOULD include argv[0] as the program name.

func NoArgs

func NoArgs(c *baseCommand, args []string) error

Returns an error if any args provided

Types

type DestroyCommand

type DestroyCommand struct {
	*StopCommand
}

func (*DestroyCommand) AutocompleteArgs

func (c *DestroyCommand) AutocompleteArgs() complete.Predictor

func (*DestroyCommand) AutocompleteFlags

func (c *DestroyCommand) AutocompleteFlags() complete.Flags

func (DestroyCommand) Close

func (c DestroyCommand) Close() error

Close cleans up any resources that the command created. This should be defered by any CLI command that embeds baseCommand in the Run command.

func (*DestroyCommand) Flags

func (c *DestroyCommand) Flags() *flag.Sets

func (DestroyCommand) GetExample

func (c DestroyCommand) GetExample() string

func (*DestroyCommand) Help

func (c *DestroyCommand) Help() string

func (DestroyCommand) Init

func (c DestroyCommand) Init(opts ...Option) error

Init initializes the command by parsing flags, parsing the configuration, setting up the project, etc. You can control what is done by using the options.

Init should be called FIRST within the Run function implementation. Many options will affect behavior of other functions that can be called later.

func (DestroyCommand) IsLinux

func (c DestroyCommand) IsLinux() bool

func (DestroyCommand) IsMac

func (c DestroyCommand) IsMac() bool

func (DestroyCommand) IsWindows

func (c DestroyCommand) IsWindows() bool

func (*DestroyCommand) Run

func (c *DestroyCommand) Run(args []string) int

func (*DestroyCommand) Synopsis

func (c *DestroyCommand) Synopsis() string

Synopsis satisfies the Synopsis function of the cli.Command interface.

type DocGenerateCommand

type DocGenerateCommand struct {
	// contains filtered or unexported fields
}

func (DocGenerateCommand) Close

func (c DocGenerateCommand) Close() error

Close cleans up any resources that the command created. This should be defered by any CLI command that embeds baseCommand in the Run command.

func (DocGenerateCommand) GetExample

func (c DocGenerateCommand) GetExample() string

func (DocGenerateCommand) Help

func (c DocGenerateCommand) Help() string

func (DocGenerateCommand) Init

func (c DocGenerateCommand) Init(opts ...Option) error

Init initializes the command by parsing flags, parsing the configuration, setting up the project, etc. You can control what is done by using the options.

Init should be called FIRST within the Run function implementation. Many options will affect behavior of other functions that can be called later.

func (DocGenerateCommand) IsLinux

func (c DocGenerateCommand) IsLinux() bool

func (DocGenerateCommand) IsMac

func (c DocGenerateCommand) IsMac() bool

func (DocGenerateCommand) IsWindows

func (c DocGenerateCommand) IsWindows() bool

func (*DocGenerateCommand) Run

func (c *DocGenerateCommand) Run(args []string) int

func (DocGenerateCommand) Synopsis

func (c DocGenerateCommand) Synopsis() string

type GenerateHelpCommand

type GenerateHelpCommand struct {
	// contains filtered or unexported fields
}

GenerateHelpCommand exists solely to provide top level help for the registry set of subcommands.

func (*GenerateHelpCommand) AutocompleteArgs

func (c *GenerateHelpCommand) AutocompleteArgs() complete.Predictor

func (*GenerateHelpCommand) AutocompleteFlags

func (c *GenerateHelpCommand) AutocompleteFlags() complete.Flags

func (GenerateHelpCommand) Close

func (c GenerateHelpCommand) Close() error

Close cleans up any resources that the command created. This should be defered by any CLI command that embeds baseCommand in the Run command.

func (*GenerateHelpCommand) Flags

func (c *GenerateHelpCommand) Flags() *flag.Sets

func (GenerateHelpCommand) GetExample

func (c GenerateHelpCommand) GetExample() string

func (*GenerateHelpCommand) Help

func (c *GenerateHelpCommand) Help() string

func (GenerateHelpCommand) Init

func (c GenerateHelpCommand) Init(opts ...Option) error

Init initializes the command by parsing flags, parsing the configuration, setting up the project, etc. You can control what is done by using the options.

Init should be called FIRST within the Run function implementation. Many options will affect behavior of other functions that can be called later.

func (GenerateHelpCommand) IsLinux

func (c GenerateHelpCommand) IsLinux() bool

func (GenerateHelpCommand) IsMac

func (c GenerateHelpCommand) IsMac() bool

func (GenerateHelpCommand) IsWindows

func (c GenerateHelpCommand) IsWindows() bool

func (*GenerateHelpCommand) Run

func (c *GenerateHelpCommand) Run(args []string) int

func (*GenerateHelpCommand) Synopsis

func (c *GenerateHelpCommand) Synopsis() string

type GeneratePackCommand

type GeneratePackCommand struct {
	// contains filtered or unexported fields
}

GeneratePackCommand adds a registry to the global cache.

func (*GeneratePackCommand) AutocompleteArgs

func (c *GeneratePackCommand) AutocompleteArgs() complete.Predictor

func (*GeneratePackCommand) AutocompleteFlags

func (c *GeneratePackCommand) AutocompleteFlags() complete.Flags

func (GeneratePackCommand) Close

func (c GeneratePackCommand) Close() error

Close cleans up any resources that the command created. This should be defered by any CLI command that embeds baseCommand in the Run command.

func (*GeneratePackCommand) Flags

func (c *GeneratePackCommand) Flags() *flag.Sets

func (GeneratePackCommand) GetExample

func (c GeneratePackCommand) GetExample() string

func (*GeneratePackCommand) Help

func (c *GeneratePackCommand) Help() string

func (GeneratePackCommand) Init

func (c GeneratePackCommand) Init(opts ...Option) error

Init initializes the command by parsing flags, parsing the configuration, setting up the project, etc. You can control what is done by using the options.

Init should be called FIRST within the Run function implementation. Many options will affect behavior of other functions that can be called later.

func (GeneratePackCommand) IsLinux

func (c GeneratePackCommand) IsLinux() bool

func (GeneratePackCommand) IsMac

func (c GeneratePackCommand) IsMac() bool

func (GeneratePackCommand) IsWindows

func (c GeneratePackCommand) IsWindows() bool

func (*GeneratePackCommand) Run

func (c *GeneratePackCommand) Run(args []string) int

func (*GeneratePackCommand) Synopsis

func (c *GeneratePackCommand) Synopsis() string

type GenerateRegistryCommand

type GenerateRegistryCommand struct {
	// contains filtered or unexported fields
}

GenerateRegistryCommand adds a registry to the global cache.

func (*GenerateRegistryCommand) AutocompleteArgs

func (c *GenerateRegistryCommand) AutocompleteArgs() complete.Predictor

func (*GenerateRegistryCommand) AutocompleteFlags

func (c *GenerateRegistryCommand) AutocompleteFlags() complete.Flags

func (GenerateRegistryCommand) Close

func (c GenerateRegistryCommand) Close() error

Close cleans up any resources that the command created. This should be defered by any CLI command that embeds baseCommand in the Run command.

func (*GenerateRegistryCommand) Flags

func (c *GenerateRegistryCommand) Flags() *flag.Sets

func (GenerateRegistryCommand) GetExample

func (c GenerateRegistryCommand) GetExample() string

func (*GenerateRegistryCommand) Help

func (c *GenerateRegistryCommand) Help() string

func (GenerateRegistryCommand) Init

func (c GenerateRegistryCommand) Init(opts ...Option) error

Init initializes the command by parsing flags, parsing the configuration, setting up the project, etc. You can control what is done by using the options.

Init should be called FIRST within the Run function implementation. Many options will affect behavior of other functions that can be called later.

func (GenerateRegistryCommand) IsLinux

func (c GenerateRegistryCommand) IsLinux() bool

func (GenerateRegistryCommand) IsMac

func (c GenerateRegistryCommand) IsMac() bool

func (GenerateRegistryCommand) IsWindows

func (c GenerateRegistryCommand) IsWindows() bool

func (*GenerateRegistryCommand) Run

func (c *GenerateRegistryCommand) Run(args []string) int

func (*GenerateRegistryCommand) Synopsis

func (c *GenerateRegistryCommand) Synopsis() string

type HasFlags

type HasFlags interface {
	Flags() *flag.Sets
}

type InfoCommand

type InfoCommand struct {
	// contains filtered or unexported fields
}

func (InfoCommand) Close

func (c InfoCommand) Close() error

Close cleans up any resources that the command created. This should be defered by any CLI command that embeds baseCommand in the Run command.

func (*InfoCommand) Flags

func (c *InfoCommand) Flags() *flag.Sets

func (InfoCommand) GetExample

func (c InfoCommand) GetExample() string

func (*InfoCommand) Help

func (c *InfoCommand) Help() string

func (InfoCommand) Init

func (c InfoCommand) Init(opts ...Option) error

Init initializes the command by parsing flags, parsing the configuration, setting up the project, etc. You can control what is done by using the options.

Init should be called FIRST within the Run function implementation. Many options will affect behavior of other functions that can be called later.

func (InfoCommand) IsLinux

func (c InfoCommand) IsLinux() bool

func (InfoCommand) IsMac

func (c InfoCommand) IsMac() bool

func (InfoCommand) IsWindows

func (c InfoCommand) IsWindows() bool

func (*InfoCommand) Run

func (c *InfoCommand) Run(args []string) int

func (*InfoCommand) Synopsis

func (c *InfoCommand) Synopsis() string

type JobStatusError

type JobStatusError struct {
	// contains filtered or unexported fields
}

JobStatusError encapsulates error information related to trying to retrieve status information about a running job.

type JobStatusInfo

type JobStatusInfo struct {
	// contains filtered or unexported fields
}

JobStatusInfo encapsulates status information about a running job.

type ListCommand

type ListCommand struct {
	// contains filtered or unexported fields
}

ListCommand lists all registries and pack that have been downloaded to the current machine.

func (*ListCommand) AutocompleteArgs

func (c *ListCommand) AutocompleteArgs() complete.Predictor

func (*ListCommand) AutocompleteFlags

func (c *ListCommand) AutocompleteFlags() complete.Flags

func (ListCommand) Close

func (c ListCommand) Close() error

Close cleans up any resources that the command created. This should be defered by any CLI command that embeds baseCommand in the Run command.

func (*ListCommand) Flags

func (c *ListCommand) Flags() *flag.Sets

func (ListCommand) GetExample

func (c ListCommand) GetExample() string

func (*ListCommand) Help

func (c *ListCommand) Help() string

func (ListCommand) Init

func (c ListCommand) Init(opts ...Option) error

Init initializes the command by parsing flags, parsing the configuration, setting up the project, etc. You can control what is done by using the options.

Init should be called FIRST within the Run function implementation. Many options will affect behavior of other functions that can be called later.

func (ListCommand) IsLinux

func (c ListCommand) IsLinux() bool

func (ListCommand) IsMac

func (c ListCommand) IsMac() bool

func (ListCommand) IsWindows

func (c ListCommand) IsWindows() bool

func (*ListCommand) Run

func (c *ListCommand) Run(args []string) int

func (*ListCommand) Synopsis

func (c *ListCommand) Synopsis() string

type Option

type Option func(c *baseConfig)

Option is used to configure Init on baseCommand.

func WithArgs

func WithArgs(args []string) Option

WithArgs sets the arguments to the command that are used for parsing. Remaining arguments can be accessed using your flag set and asking for Args. Example: c.Flags().Args().

func WithClient

func WithClient(v bool) Option

WithClient configures the CLI to initialize a client.

func WithConfig

func WithConfig(optional bool) Option

WithConfig configures the CLI to find and load any project configuration. If optional is true, no error will be shown if a config can't be found.

func WithCustomArgs

func WithCustomArgs(args []string, customValidation ValidationFn) Option

The same as WithArgs, but also assigns a custom validation function which will return an error if the custom validation criteria are not met. Only the function is assigned; acutal validation happens after the flags have been parsed.

func WithExactArgs

func WithExactArgs(n int, args []string) Option

The same as WithArgs, but also assigns the validation function ExactArgs which returns an error if exactly N args aren't provided. Only the function is assigned; actual validation happens after the flags have been parsed.

func WithFlags

func WithFlags(f *flag.Sets) Option

WithFlags sets the flags that are supported by this command. This MUST be set otherwise a panic will happen. This is usually set by just calling the Flags function on your command implementation.

func WithMaximumNArgs

func WithMaximumNArgs(n int, args []string) Option

The same as WithArgs, but also assigns the validation function MaximumNArgs which returns an error if more than N args are provided. Only the function is assigned; actual validation happens after the flags have been parsed.

func WithMinimumNArgs

func WithMinimumNArgs(n int, args []string) Option

The same as WithArgs, but also assigns the validation function MinimumNArgs which returns an error if fewer than N args are provided. Only the function is assigned; actual validation happens after the flags have been parsed.

func WithNoArgs

func WithNoArgs(args []string) Option

The same as WithArgs, but also assigns the validation function NoArgs which returns an error if any args are provided. Only the function is assigned; actual validation happens after the flags have been parsed.

func WithNoConfig

func WithNoConfig() Option

WithNoConfig configures the CLI to not expect any project configuration. This will not read any configuration files.

func WithSingleApp

func WithSingleApp() Option

WithSingleApp configures the CLI to expect a configuration with one or more apps defined but a single app targeted with `-app`. If only a single app exists, it is implicitly the target. Zero apps is an error.

func WithUI

func WithUI(ui terminal.UI) Option

WithUI configures the CLI to use a specific UI implementation

type PlanCommand

type PlanCommand struct {
	// contains filtered or unexported fields
}

func (*PlanCommand) AutocompleteArgs

func (c *PlanCommand) AutocompleteArgs() complete.Predictor

func (*PlanCommand) AutocompleteFlags

func (c *PlanCommand) AutocompleteFlags() complete.Flags

func (PlanCommand) Close

func (c PlanCommand) Close() error

Close cleans up any resources that the command created. This should be defered by any CLI command that embeds baseCommand in the Run command.

func (*PlanCommand) Flags

func (c *PlanCommand) Flags() *flag.Sets

func (PlanCommand) GetExample

func (c PlanCommand) GetExample() string

func (*PlanCommand) Help

func (c *PlanCommand) Help() string

func (PlanCommand) Init

func (c PlanCommand) Init(opts ...Option) error

Init initializes the command by parsing flags, parsing the configuration, setting up the project, etc. You can control what is done by using the options.

Init should be called FIRST within the Run function implementation. Many options will affect behavior of other functions that can be called later.

func (PlanCommand) IsLinux

func (c PlanCommand) IsLinux() bool

func (PlanCommand) IsMac

func (c PlanCommand) IsMac() bool

func (PlanCommand) IsWindows

func (c PlanCommand) IsWindows() bool

func (*PlanCommand) Run

func (c *PlanCommand) Run(args []string) int

func (*PlanCommand) Synopsis

func (c *PlanCommand) Synopsis() string

Synopsis satisfies the Synopsis function of the cli.Command interface.

type RegistryAddCommand

type RegistryAddCommand struct {
	// contains filtered or unexported fields
}

RegistryAddCommand adds a registry to the global cache.

func (*RegistryAddCommand) AutocompleteArgs

func (c *RegistryAddCommand) AutocompleteArgs() complete.Predictor

func (*RegistryAddCommand) AutocompleteFlags

func (c *RegistryAddCommand) AutocompleteFlags() complete.Flags

func (RegistryAddCommand) Close

func (c RegistryAddCommand) Close() error

Close cleans up any resources that the command created. This should be defered by any CLI command that embeds baseCommand in the Run command.

func (*RegistryAddCommand) Flags

func (c *RegistryAddCommand) Flags() *flag.Sets

func (RegistryAddCommand) GetExample

func (c RegistryAddCommand) GetExample() string

func (*RegistryAddCommand) Help

func (c *RegistryAddCommand) Help() string

func (RegistryAddCommand) Init

func (c RegistryAddCommand) Init(opts ...Option) error

Init initializes the command by parsing flags, parsing the configuration, setting up the project, etc. You can control what is done by using the options.

Init should be called FIRST within the Run function implementation. Many options will affect behavior of other functions that can be called later.

func (RegistryAddCommand) IsLinux

func (c RegistryAddCommand) IsLinux() bool

func (RegistryAddCommand) IsMac

func (c RegistryAddCommand) IsMac() bool

func (RegistryAddCommand) IsWindows

func (c RegistryAddCommand) IsWindows() bool

func (*RegistryAddCommand) Run

func (c *RegistryAddCommand) Run(args []string) int

func (*RegistryAddCommand) Synopsis

func (c *RegistryAddCommand) Synopsis() string

type RegistryDeleteCommand

type RegistryDeleteCommand struct {
	// contains filtered or unexported fields
}

RegistryDeleteCommand deletes a registry from the global cache.

func (*RegistryDeleteCommand) AutocompleteArgs

func (c *RegistryDeleteCommand) AutocompleteArgs() complete.Predictor

func (*RegistryDeleteCommand) AutocompleteFlags

func (c *RegistryDeleteCommand) AutocompleteFlags() complete.Flags

func (RegistryDeleteCommand) Close

func (c RegistryDeleteCommand) Close() error

Close cleans up any resources that the command created. This should be defered by any CLI command that embeds baseCommand in the Run command.

func (*RegistryDeleteCommand) Flags

func (c *RegistryDeleteCommand) Flags() *flag.Sets

func (RegistryDeleteCommand) GetExample

func (c RegistryDeleteCommand) GetExample() string

func (*RegistryDeleteCommand) Help

func (c *RegistryDeleteCommand) Help() string

func (RegistryDeleteCommand) Init

func (c RegistryDeleteCommand) Init(opts ...Option) error

Init initializes the command by parsing flags, parsing the configuration, setting up the project, etc. You can control what is done by using the options.

Init should be called FIRST within the Run function implementation. Many options will affect behavior of other functions that can be called later.

func (RegistryDeleteCommand) IsLinux

func (c RegistryDeleteCommand) IsLinux() bool

func (RegistryDeleteCommand) IsMac

func (c RegistryDeleteCommand) IsMac() bool

func (RegistryDeleteCommand) IsWindows

func (c RegistryDeleteCommand) IsWindows() bool

func (*RegistryDeleteCommand) Run

func (c *RegistryDeleteCommand) Run(args []string) int

func (*RegistryDeleteCommand) Synopsis

func (c *RegistryDeleteCommand) Synopsis() string

type RegistryHelpCommand

type RegistryHelpCommand struct {
	// contains filtered or unexported fields
}

RegistryHelpCommand exists solely to provide top level help for the registry set of subcommands.

func (*RegistryHelpCommand) AutocompleteArgs

func (c *RegistryHelpCommand) AutocompleteArgs() complete.Predictor

func (*RegistryHelpCommand) AutocompleteFlags

func (c *RegistryHelpCommand) AutocompleteFlags() complete.Flags

func (RegistryHelpCommand) Close

func (c RegistryHelpCommand) Close() error

Close cleans up any resources that the command created. This should be defered by any CLI command that embeds baseCommand in the Run command.

func (*RegistryHelpCommand) Flags

func (c *RegistryHelpCommand) Flags() *flag.Sets

func (RegistryHelpCommand) GetExample

func (c RegistryHelpCommand) GetExample() string

func (*RegistryHelpCommand) Help

func (c *RegistryHelpCommand) Help() string

func (RegistryHelpCommand) Init

func (c RegistryHelpCommand) Init(opts ...Option) error

Init initializes the command by parsing flags, parsing the configuration, setting up the project, etc. You can control what is done by using the options.

Init should be called FIRST within the Run function implementation. Many options will affect behavior of other functions that can be called later.

func (RegistryHelpCommand) IsLinux

func (c RegistryHelpCommand) IsLinux() bool

func (RegistryHelpCommand) IsMac

func (c RegistryHelpCommand) IsMac() bool

func (RegistryHelpCommand) IsWindows

func (c RegistryHelpCommand) IsWindows() bool

func (*RegistryHelpCommand) Run

func (c *RegistryHelpCommand) Run(args []string) int

func (*RegistryHelpCommand) Synopsis

func (c *RegistryHelpCommand) Synopsis() string

type RegistryListCommand

type RegistryListCommand struct {
	// contains filtered or unexported fields
}

RegistryListCommand lists all registries and pack that have been downloaded to the current machine.

func (*RegistryListCommand) AutocompleteArgs

func (c *RegistryListCommand) AutocompleteArgs() complete.Predictor

func (*RegistryListCommand) AutocompleteFlags

func (c *RegistryListCommand) AutocompleteFlags() complete.Flags

func (RegistryListCommand) Close

func (c RegistryListCommand) Close() error

Close cleans up any resources that the command created. This should be defered by any CLI command that embeds baseCommand in the Run command.

func (*RegistryListCommand) Flags

func (c *RegistryListCommand) Flags() *flag.Sets

func (RegistryListCommand) GetExample

func (c RegistryListCommand) GetExample() string

func (*RegistryListCommand) Help

func (c *RegistryListCommand) Help() string

func (RegistryListCommand) Init

func (c RegistryListCommand) Init(opts ...Option) error

Init initializes the command by parsing flags, parsing the configuration, setting up the project, etc. You can control what is done by using the options.

Init should be called FIRST within the Run function implementation. Many options will affect behavior of other functions that can be called later.

func (RegistryListCommand) IsLinux

func (c RegistryListCommand) IsLinux() bool

func (RegistryListCommand) IsMac

func (c RegistryListCommand) IsMac() bool

func (RegistryListCommand) IsWindows

func (c RegistryListCommand) IsWindows() bool

func (*RegistryListCommand) Run

func (c *RegistryListCommand) Run(args []string) int

func (*RegistryListCommand) Synopsis

func (c *RegistryListCommand) Synopsis() string

type Render

type Render struct {
	Name    string
	Content string
}

type RenderCommand

type RenderCommand struct {
	// contains filtered or unexported fields
}

RenderCommand is a command that allows users to render the templates within a pack and display them on the console. This is useful when developing or debugging packs.

func (*RenderCommand) AutocompleteArgs

func (c *RenderCommand) AutocompleteArgs() complete.Predictor

func (*RenderCommand) AutocompleteFlags

func (c *RenderCommand) AutocompleteFlags() complete.Flags

func (RenderCommand) Close

func (c RenderCommand) Close() error

Close cleans up any resources that the command created. This should be defered by any CLI command that embeds baseCommand in the Run command.

func (*RenderCommand) Flags

func (c *RenderCommand) Flags() *flag.Sets

func (RenderCommand) GetExample

func (c RenderCommand) GetExample() string

func (*RenderCommand) Help

func (c *RenderCommand) Help() string

Help satisfies the Help function of the cli.Command interface.

func (RenderCommand) Init

func (c RenderCommand) Init(opts ...Option) error

Init initializes the command by parsing flags, parsing the configuration, setting up the project, etc. You can control what is done by using the options.

Init should be called FIRST within the Run function implementation. Many options will affect behavior of other functions that can be called later.

func (RenderCommand) IsLinux

func (c RenderCommand) IsLinux() bool

func (RenderCommand) IsMac

func (c RenderCommand) IsMac() bool

func (RenderCommand) IsWindows

func (c RenderCommand) IsWindows() bool

func (*RenderCommand) Run

func (c *RenderCommand) Run(args []string) int

Run satisfies the Run function of the cli.Command interface.

func (*RenderCommand) Synopsis

func (c *RenderCommand) Synopsis() string

Synopsis satisfies the Synopsis function of the cli.Command interface.

type RunCommand

type RunCommand struct {
	Validation ValidationFn
	// contains filtered or unexported fields
}

func (*RunCommand) AutocompleteArgs

func (c *RunCommand) AutocompleteArgs() complete.Predictor

func (*RunCommand) AutocompleteFlags

func (c *RunCommand) AutocompleteFlags() complete.Flags

func (RunCommand) Close

func (c RunCommand) Close() error

Close cleans up any resources that the command created. This should be defered by any CLI command that embeds baseCommand in the Run command.

func (*RunCommand) Flags

func (c *RunCommand) Flags() *flag.Sets

Flags defines the flag.Sets for the operation.

func (RunCommand) GetExample

func (c RunCommand) GetExample() string

func (*RunCommand) Help

func (c *RunCommand) Help() string

func (RunCommand) Init

func (c RunCommand) Init(opts ...Option) error

Init initializes the command by parsing flags, parsing the configuration, setting up the project, etc. You can control what is done by using the options.

Init should be called FIRST within the Run function implementation. Many options will affect behavior of other functions that can be called later.

func (RunCommand) IsLinux

func (c RunCommand) IsLinux() bool

func (RunCommand) IsMac

func (c RunCommand) IsMac() bool

func (RunCommand) IsWindows

func (c RunCommand) IsWindows() bool

func (*RunCommand) Run

func (c *RunCommand) Run(args []string) int

func (*RunCommand) Synopsis

func (c *RunCommand) Synopsis() string

Synopsis satisfies the Synopsis function of the cli.Command interface.

type StatusCommand

type StatusCommand struct {
	// contains filtered or unexported fields
}

func (*StatusCommand) AutocompleteArgs

func (c *StatusCommand) AutocompleteArgs() complete.Predictor

func (*StatusCommand) AutocompleteFlags

func (c *StatusCommand) AutocompleteFlags() complete.Flags

func (StatusCommand) Close

func (c StatusCommand) Close() error

Close cleans up any resources that the command created. This should be defered by any CLI command that embeds baseCommand in the Run command.

func (*StatusCommand) Flags

func (c *StatusCommand) Flags() *flag.Sets

func (StatusCommand) GetExample

func (c StatusCommand) GetExample() string

func (*StatusCommand) Help

func (c *StatusCommand) Help() string

func (StatusCommand) Init

func (c StatusCommand) Init(opts ...Option) error

Init initializes the command by parsing flags, parsing the configuration, setting up the project, etc. You can control what is done by using the options.

Init should be called FIRST within the Run function implementation. Many options will affect behavior of other functions that can be called later.

func (StatusCommand) IsLinux

func (c StatusCommand) IsLinux() bool

func (StatusCommand) IsMac

func (c StatusCommand) IsMac() bool

func (StatusCommand) IsWindows

func (c StatusCommand) IsWindows() bool

func (*StatusCommand) Run

func (c *StatusCommand) Run(args []string) int

func (*StatusCommand) Synopsis

func (c *StatusCommand) Synopsis() string

type StopCommand

type StopCommand struct {
	Validation ValidationFn
	// contains filtered or unexported fields
}

func (*StopCommand) AutocompleteArgs

func (c *StopCommand) AutocompleteArgs() complete.Predictor

func (*StopCommand) AutocompleteFlags

func (c *StopCommand) AutocompleteFlags() complete.Flags

func (StopCommand) Close

func (c StopCommand) Close() error

Close cleans up any resources that the command created. This should be defered by any CLI command that embeds baseCommand in the Run command.

func (*StopCommand) Flags

func (c *StopCommand) Flags() *flag.Sets

func (StopCommand) GetExample

func (c StopCommand) GetExample() string

func (*StopCommand) Help

func (c *StopCommand) Help() string

func (StopCommand) Init

func (c StopCommand) Init(opts ...Option) error

Init initializes the command by parsing flags, parsing the configuration, setting up the project, etc. You can control what is done by using the options.

Init should be called FIRST within the Run function implementation. Many options will affect behavior of other functions that can be called later.

func (StopCommand) IsLinux

func (c StopCommand) IsLinux() bool

func (StopCommand) IsMac

func (c StopCommand) IsMac() bool

func (StopCommand) IsWindows

func (c StopCommand) IsWindows() bool

func (*StopCommand) Run

func (c *StopCommand) Run(args []string) int

func (*StopCommand) Synopsis

func (c *StopCommand) Synopsis() string

Synopsis satisfies the Synopsis function of the cli.Command interface.

type ValidationFn

type ValidationFn func(c *baseCommand, args []string) error

func ExactArgs

func ExactArgs(n int) ValidationFn

Returns an error if exactly N args aren't provided

func MaximumNArgs

func MaximumNArgs(n int) ValidationFn

Returns an error if more than N args provided

func MinimumNArgs

func MinimumNArgs(n int) ValidationFn

Returns an error if fewer than N args provided

type VersionCommand

type VersionCommand struct {
	// contains filtered or unexported fields
}

func (*VersionCommand) AutocompleteArgs

func (c *VersionCommand) AutocompleteArgs() complete.Predictor

func (*VersionCommand) AutocompleteFlags

func (c *VersionCommand) AutocompleteFlags() complete.Flags

func (VersionCommand) Close

func (c VersionCommand) Close() error

Close cleans up any resources that the command created. This should be defered by any CLI command that embeds baseCommand in the Run command.

func (*VersionCommand) Flags

func (c *VersionCommand) Flags() *flag.Sets

func (VersionCommand) GetExample

func (c VersionCommand) GetExample() string

func (*VersionCommand) Help

func (c *VersionCommand) Help() string

func (VersionCommand) Init

func (c VersionCommand) Init(opts ...Option) error

Init initializes the command by parsing flags, parsing the configuration, setting up the project, etc. You can control what is done by using the options.

Init should be called FIRST within the Run function implementation. Many options will affect behavior of other functions that can be called later.

func (VersionCommand) IsLinux

func (c VersionCommand) IsLinux() bool

func (VersionCommand) IsMac

func (c VersionCommand) IsMac() bool

func (VersionCommand) IsWindows

func (c VersionCommand) IsWindows() bool

func (*VersionCommand) Run

func (c *VersionCommand) Run(args []string) int

func (*VersionCommand) Synopsis

func (c *VersionCommand) Synopsis() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL