commands

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CLI struct {
	Debug   bool        `help:"Enable debug mode."`
	JSON    bool        `help:"Output in JSON format." name:"json"`
	Version VersionFlag `name:"version" help:"Print version information and quit."`

	Create  CreateCommand  `cmd:"" help:"Create a new droplet." default:"withargs"`
	Ls      LsCommand      `cmd:"" help:"List droplets."`
	Rm      RmCommand      `cmd:"" help:"Remove one or more droplets."`
	Status  StatusCommand  `cmd:"" help:"Show version and API connectivity."`
	Options OptionsCommand `cmd:"" help:"Show available region and size options."`
}

Functions

This section is empty.

Types

type CreateCommand

type CreateCommand struct {
	Region string `help:"Region of the droplet." short:"r" enum:"usw,use,eu,ap,au" default:"eu"`
	Size   string `help:"Size of the droplet." short:"s" enum:"xs,s,m,l,xl" default:"xs"`
	Name   string `help:"Name of the droplet." short:"n"`
}

CreateCommand creates a new droplet.

func (*CreateCommand) Run

func (cmd *CreateCommand) Run(client *do.Client, globals *Globals) error

Run executes the create command.

type Globals

type Globals struct {
	JSON   bool
	Logger *zap.SugaredLogger
}

Globals holds shared state passed to all commands.

type LsCommand

type LsCommand struct{}

LsCommand lists all droplets.

func (*LsCommand) Run

func (cmd *LsCommand) Run(client *do.Client, globals *Globals) error

Run executes the ls command.

type OptionsCommand

type OptionsCommand struct{}

OptionsCommand displays available region and size mappings.

func (*OptionsCommand) Run

func (cmd *OptionsCommand) Run(globals *Globals) error

Run executes the options command.

type RmCommand

type RmCommand struct {
	IDs []int `arg:"" help:"Droplet ID(s) to remove." name:"id" required:""`
}

RmCommand removes one or more droplets.

func (*RmCommand) Run

func (cmd *RmCommand) Run(client *do.Client, globals *Globals) error

Run executes the rm command.

type StatusCommand

type StatusCommand struct{}

StatusCommand shows version and API connectivity.

func (*StatusCommand) Run

func (cmd *StatusCommand) Run(client *do.Client, globals *Globals) error

Run executes the status command.

type VersionFlag

type VersionFlag string

VersionFlag prints the version and exits.

func (VersionFlag) BeforeApply

func (v VersionFlag) BeforeApply(app *kong.Kong, vars kong.Vars) error

func (VersionFlag) Decode

func (v VersionFlag) Decode(ctx *kong.DecodeContext) error

func (VersionFlag) IsBool

func (v VersionFlag) IsBool() bool

Jump to

Keyboard shortcuts

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