program

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NoFilter = &Filter{
	Include: []*regexp.Regexp{regexp.MustCompile(".*")},
	Exclude: []*regexp.Regexp{},
}
View Source
var Version = "unknown"

Functions

func AcceptAllLines

func AcceptAllLines(fields cumulus.Fields) bool

func Display

func Display[T cumulus.Common](ctx context.Context, options Options, list *CommonList, typename string, items chan T)

Types

type Accounts

type Accounts struct {
	List List `cmd:""`
}

type CommonList

type CommonList struct {
	CredentialsFile string   `group:"AWS" short:"c" help:"AWS Credentials File" type:"existingfile" default:"~/.aws/credentials"`
	Include         []string `group:"Output" short:"I" help:"List of field regexps to include"`
	Exclude         []string `group:"Output" short:"X" help:"List of fields regexps to exclude"`
	IncludeAll      bool     `group:"Output" short:"A" help:"Include all fields"`
	ListExpression  []string `group:"Output" short:"l" help:"Expression to use to filter fields"`
}

type Filter

type Filter struct {
	Include, Exclude []*regexp.Regexp
}

func NewFilter

func NewFilter(include, exclude []string) *Filter

func (*Filter) Accept

func (f *Filter) Accept(meta cumulus.FieldMeta) bool

type InstanceList

type InstanceList struct {
	CommonList `embed:""`
}

func (*InstanceList) Run

func (list *InstanceList) Run(program Options) error

type LineFilter

type LineFilter func(fields cumulus.Fields) bool

func ParseExpression

func ParseExpression(expr string) (LineFilter, error)

func ParseFilter

func ParseFilter(s string) (LineFilter, error)

func ParseFilters

func ParseFilters(s []string) (LineFilter, error)

type List

type List struct {
	CommonList
}

func (*List) Run

func (list *List) Run(program Options) error

type MachineImageList

type MachineImageList struct {
	CommonList `embed:""`
}

func (*MachineImageList) Run

func (list *MachineImageList) Run(program Options) error

type Options

type Options struct {
	Version bool `help:"Show program version"`

	Account  Accounts `cmd:""`
	Instance struct {
		List InstanceList `cmd:""`
	} `cmd:""`
	Snapshot struct {
		List SnapshotList `cmd:""`
	} `cmd:""`
	MachineImage struct {
		List MachineImageList `cmd:""`
	} `cmd:""`
	Volume struct {
		List VolumeList `cmd:""`
	} `cmd:""`

	DNS struct {
		Zone struct {
			List ZoneList `cmd:""`
		} `cmd:""`
		Record struct {
			List RecordList `cmd:""`
		} `cmd:""`
	} `cmd:""`

	Debug        bool   `group:"Output" help:"Show debugging information"`
	OutputFormat string `group:"Output" enum:"auto,jsonl,terminal" default:"auto" help:"How to show program output (auto|terminal|jsonl)"`
	Quiet        bool   `group:"Output" short:"q" help:"Be less verbose than usual"`
	Verbose      bool   `group:"Output" short:"v" help:"Be more verbose than usual"`
	Profile      struct {
		CPU    bool `group:"Profile" help:"profile the CPU"`
		Memory bool `group:"Profile" help:"profile the Memory usage"`
	} `embed:"" prefix:"profile."`
}

Options is the structure of program options

func (*Options) AfterApply

func (program *Options) AfterApply() error

AfterApply runs after the options are parsed but before anything runs

func (*Options) Parse

func (program *Options) Parse(args []string) (*kong.Context, error)

Parse calls the CLI parsing routines

func (*Options) Run

func (program *Options) Run() error

Run runs the program

type RecordList

type RecordList struct {
	CommonList `embed:""`
}

func (*RecordList) Run

func (list *RecordList) Run(program Options) error

type RingArray

type RingArray struct {
	Values  []int
	Current int
}

func (*RingArray) Add

func (r *RingArray) Add(val int)

func (RingArray) Average

func (r RingArray) Average() int

type SnapshotList

type SnapshotList struct {
	CommonList `embed:""`
}

func (*SnapshotList) Run

func (list *SnapshotList) Run(program Options) error

type VersionCmd

type VersionCmd struct{}

VersionCmd prints the program version

func (*VersionCmd) Run

func (v *VersionCmd) Run(program *Options) error

type VolumeList

type VolumeList struct {
	CommonList `embed:""`
}

func (*VolumeList) Run

func (list *VolumeList) Run(program Options) error

type ZoneList

type ZoneList struct {
	CommonList `embed:""`
}

func (*ZoneList) Run

func (list *ZoneList) Run(program Options) error

Jump to

Keyboard shortcuts

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