builder

package
v0.0.0-...-df6e0f9 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FlagRegistry = []Flag{
	{
		Name:          "region",
		Shorthand:     "r",
		Usage:         "Run command to specific region",
		Value:         aws.String(constants.EmptyString),
		DefValue:      "ap-northeast-2",
		FlagAddMethod: "StringVar",
		DefinedOn:     []string{"rds-token", "who", "describe-web-acl"},
	},
	{
		Name:          "duration",
		Shorthand:     "d",
		Usage:         "Duration of IAM assume role session time",
		Value:         aws.Int(constants.DefaultDuration),
		DefValue:      constants.DefaultDuration,
		FlagAddMethod: "IntVar",
		DefinedOn:     []string{"setup"},
	},
	{
		Name:          "profile",
		Shorthand:     "p",
		Usage:         "Profile you want to use",
		Value:         aws.String("default"),
		DefValue:      "default",
		FlagAddMethod: "StringVar",
		DefinedOn:     []string{"rds-token", "setup", "list", "renew-credential", "describe-web-acl", "has-ip", "start", "stop", "status", "exec", "ecr-login"},
	},
	{
		Name:          "raw-output",
		Usage:         "show raw output without copying to clipboard",
		Value:         aws.Bool(false),
		DefValue:      false,
		FlagAddMethod: "BoolVar",
		DefinedOn:     []string{"setup"},
	},
}

FlagRegistry is a list of all act CLI flags.

Functions

func SetCommandFlags

func SetCommandFlags(cmd *cobra.Command)

Add command flags

Types

type Builder

type Builder interface {
	WithDescription(description string) Builder
	WithLongDescription(description string) Builder
	SetAliases(alias []string) Builder
	AddCommands(children ...*cobra.Command) Builder
	SetFlags() Builder
	WithFlags(adder func(*pflag.FlagSet)) Builder
	RunWithNoArgs(action func(context.Context, io.Writer) error) *cobra.Command
	RunWithArgs(action func(context.Context, io.Writer, []string) error) *cobra.Command
	RunWithArgsAndCmd(action func(context.Context, io.Writer, *cobra.Command, []string) error) *cobra.Command
	ReturnCmd() cobra.Command
}

func NewCmd

func NewCmd(use string) Builder

NewCmd creates a new command builder.

type Flag

type Flag struct {
	Name               string
	Shorthand          string
	Usage              string
	Value              interface{}
	DefValue           interface{}
	DefValuePerCommand map[string]interface{}
	FlagAddMethod      string
	DefinedOn          []string
	Hidden             bool
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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