Help us shape the future of Go! Take the 2026 Go Developer Survey

command

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: MPL-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(args []string) int

func RunCustom

func RunCustom(args []string, runOpts *RunOptions) int

RunCustom allows passing in a base command template to pass to other commands. Currently, this is only used for setting a custom token helper.

Types

type BaseCommand

type BaseCommand struct {
	UI cli.Ui
	// contains filtered or unexported fields
}

type BoolPtr

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

BoolPtr is a bool which is aware if it has been set.

func (*BoolPtr) Get

func (b *BoolPtr) Get() bool

func (*BoolPtr) IsSet

func (b *BoolPtr) IsSet() bool

func (*BoolPtr) Set

func (b *BoolPtr) Set(v string) error

func (*BoolPtr) String

func (b *BoolPtr) String() string

type BoolPtrVar

type BoolPtrVar struct {
	Name       string
	Aliases    []string
	Usage      string
	Hidden     bool
	EnvVar     string
	Default    *bool
	Target     *BoolPtr
	Completion complete.Predictor
}

type BoolVar

type BoolVar struct {
	Name       string
	Aliases    []string
	Usage      string
	Default    bool
	Hidden     bool
	EnvVar     string
	Target     *bool
	Completion complete.Predictor
}

-- BoolVar and boolValue

type DurationVar

type DurationVar struct {
	Name       string
	Aliases    []string
	Usage      string
	Default    time.Duration
	Hidden     bool
	EnvVar     string
	Target     *time.Duration
	Completion complete.Predictor
}

-- DurationVar and durationValue

type FlagBool

type FlagBool interface {
	IsBoolFlag() bool
}

FlagBool is an interface which boolean flags implement.

type FlagExample

type FlagExample interface {
	Example() string
}

FlagExample is an interface which declares an example value.

type FlagSet

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

FlagSet is a grouped wrapper around a real flag set and a grouped flag set.

func NewFlagSet

func NewFlagSet(name string) *FlagSet

NewFlagSet creates a new flag set.

func (*FlagSet) BoolPtrVar

func (f *FlagSet) BoolPtrVar(i *BoolPtrVar)

func (*FlagSet) BoolVar

func (f *FlagSet) BoolVar(i *BoolVar)

func (*FlagSet) DurationVar

func (f *FlagSet) DurationVar(i *DurationVar)

func (*FlagSet) Float64Var

func (f *FlagSet) Float64Var(i *Float64Var)

func (*FlagSet) Int64Var

func (f *FlagSet) Int64Var(i *Int64Var)

func (*FlagSet) IntVar

func (f *FlagSet) IntVar(i *IntVar)

func (*FlagSet) Name

func (f *FlagSet) Name() string

Name returns the name of this flag set.

func (*FlagSet) StringMapVar

func (f *FlagSet) StringMapVar(i *StringMapVar)

func (*FlagSet) StringSliceVar

func (f *FlagSet) StringSliceVar(i *StringSliceVar)

func (*FlagSet) StringVar

func (f *FlagSet) StringVar(i *StringVar)

func (*FlagSet) TimeVar

func (f *FlagSet) TimeVar(i *TimeVar)

func (*FlagSet) Uint64Var

func (f *FlagSet) Uint64Var(i *Uint64Var)

func (*FlagSet) UintVar

func (f *FlagSet) UintVar(i *UintVar)

func (*FlagSet) Var

func (f *FlagSet) Var(value flag.Value, name, usage string)

Var is a lower-level API for adding something to the flags. It should be used with caution, since it bypasses all validation. Consider VarFlag instead.

func (*FlagSet) VarFlag

func (f *FlagSet) VarFlag(i *VarFlag)

func (*FlagSet) Visit

func (f *FlagSet) Visit(fn func(*flag.Flag))

func (*FlagSet) VisitAll

func (f *FlagSet) VisitAll(fn func(*flag.Flag))

type FlagSets

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

FlagSets is a group of flag sets.

func NewFlagSets

func NewFlagSets(ui cli.Ui) *FlagSets

NewFlagSets creates a new flag sets.

func (*FlagSets) Args

func (f *FlagSets) Args() []string

Args returns the remaining args after parsing.

func (*FlagSets) Completions

func (f *FlagSets) Completions() complete.Flags

Completions returns the completions for this flag set.

func (*FlagSets) Help

func (f *FlagSets) Help() string

Help builds custom help for this command, grouping by flag set.

func (*FlagSets) NewFlagSet

func (f *FlagSets) NewFlagSet(name string) *FlagSet

NewFlagSet creates a new flag set from the given flag sets.

func (*FlagSets) Parse

func (f *FlagSets) Parse(args []string, opts ...ParseOptions) error

Parse parses the given flags, returning any errors. Warnings, if any, regarding the arguments format are sent to stdout

func (*FlagSets) Parsed

func (f *FlagSets) Parsed() bool

Parsed reports whether the command-line flags have been parsed.

func (*FlagSets) Visit

func (f *FlagSets) Visit(fn func(*flag.Flag))

Visit visits the flags in lexicographical order, calling fn for each. It visits only those flags that have been set.

type FlagVisibility

type FlagVisibility interface {
	Hidden() bool
}

FlagVisibility is an interface which declares whether a flag should be hidden from help and completions. This is usually used for deprecations on "internal-only" flags.

type Float64Var

type Float64Var struct {
	Name       string
	Aliases    []string
	Usage      string
	Default    float64
	Hidden     bool
	EnvVar     string
	Target     *float64
	Completion complete.Predictor
}

-- Float64Var and float64Value

type Int64Var

type Int64Var struct {
	Name       string
	Aliases    []string
	Usage      string
	Default    int64
	Hidden     bool
	EnvVar     string
	Target     *int64
	Completion complete.Predictor
}

-- Int64Var and int64Value

type IntVar

type IntVar struct {
	Name       string
	Aliases    []string
	Usage      string
	Default    int
	Hidden     bool
	EnvVar     string
	Target     *int
	Completion complete.Predictor
}

-- IntVar and intValue

type ParseOptionAllowRawFormat

type ParseOptionAllowRawFormat bool

type ParseOptions

type ParseOptions interface{}

type ReviewCommand

type ReviewCommand struct {
	*BaseCommand
	// contains filtered or unexported fields
}

func (*ReviewCommand) AutocompleteArgs

func (r *ReviewCommand) AutocompleteArgs() complete.Predictor

func (*ReviewCommand) AutocompleteFlags

func (r *ReviewCommand) AutocompleteFlags() complete.Flags

func (*ReviewCommand) Flags

func (r *ReviewCommand) Flags() *FlagSets

func (*ReviewCommand) Help

func (r *ReviewCommand) Help() string

func (*ReviewCommand) Run

func (r *ReviewCommand) Run(args []string) int

func (*ReviewCommand) Synopsis

func (r *ReviewCommand) Synopsis() string

type RunCommand

type RunCommand struct {
	*BaseCommand
	// contains filtered or unexported fields
}

func (*RunCommand) AutocompleteArgs

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

func (*RunCommand) AutocompleteFlags

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

func (*RunCommand) Flags

func (r *RunCommand) Flags() *FlagSets

func (*RunCommand) Help

func (r *RunCommand) Help() string

func (*RunCommand) Run

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

func (*RunCommand) Synopsis

func (r *RunCommand) Synopsis() string

type RunOptions

type RunOptions struct {
	Stdout  io.Writer
	Stderr  io.Writer
	Address string
	Client  *api.Client
}

type StringMapVar

type StringMapVar struct {
	Name       string
	Aliases    []string
	Usage      string
	Default    map[string]string
	Hidden     bool
	Target     *map[string]string
	Completion complete.Predictor
}

-- StringMapVar and stringMapValue

type StringSliceVar

type StringSliceVar struct {
	Name       string
	Aliases    []string
	Usage      string
	Default    []string
	Hidden     bool
	EnvVar     string
	Target     *[]string
	Completion complete.Predictor
}

-- StringSliceVar and stringSliceValue

type StringVar

type StringVar struct {
	Name       string
	Aliases    []string
	Usage      string
	Default    string
	Hidden     bool
	EnvVar     string
	Target     *string
	Completion complete.Predictor
}

-- StringVar and stringValue

type TimeFormat

type TimeFormat int

Identify the allowable formats, identified by the minimum precision accepted. TODO: move this somewhere where it can be re-used for the API.

const (
	TimeVar_EpochSecond TimeFormat = 1 << iota
	TimeVar_RFC3339Nano
	TimeVar_RFC3339Second
	TimeVar_Day
	TimeVar_Month
)

Default value to use

type TimeVar

type TimeVar struct {
	Name       string
	Aliases    []string
	Usage      string
	Default    time.Time
	Hidden     bool
	EnvVar     string
	Target     *time.Time
	Completion complete.Predictor
	Formats    TimeFormat
}

-- TimeVar and timeValue

type Uint64Var

type Uint64Var struct {
	Name       string
	Aliases    []string
	Usage      string
	Default    uint64
	Hidden     bool
	EnvVar     string
	Target     *uint64
	Completion complete.Predictor
}

-- Uint64Var and uint64Value

type UintVar

type UintVar struct {
	Name       string
	Aliases    []string
	Usage      string
	Default    uint
	Hidden     bool
	EnvVar     string
	Target     *uint
	Completion complete.Predictor
}

-- UintVar && uintValue

type VarFlag

type VarFlag struct {
	Name       string
	Aliases    []string
	Usage      string
	Default    string
	EnvVar     string
	Value      flag.Value
	Completion complete.Predictor
}

-- VarFlag

type VaultUI

type VaultUI struct {
	cli.Ui
	// contains filtered or unexported fields
}

type VersionCommand

type VersionCommand struct {
	*BaseCommand
}

VersionCommand is a Command implementation prints the version.

func (*VersionCommand) AutocompleteArgs

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

func (*VersionCommand) AutocompleteFlags

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

func (*VersionCommand) Flags

func (c *VersionCommand) Flags() *FlagSets

func (*VersionCommand) Help

func (c *VersionCommand) Help() string

func (*VersionCommand) Run

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

func (*VersionCommand) Synopsis

func (c *VersionCommand) Synopsis() string

Jump to

Keyboard shortcuts

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