cli

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2015 License: MIT Imports: 26 Imported by: 0

Documentation

Overview

Package cli contains CLI commands

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrExitFailure = errors.New("exit 1")
	ErrExitSuccess = errors.New("exit 0")
)

errors

View Source
var CmdHelp = &Command{
	Exec:        nil,
	UsageLine:   "help [COMMAND]",
	Description: "help of the scw command line",
	Help: `
Help prints help information about scw and its commands.

By default, help lists available commands with a short description.
When invoked with a command name, it prints the usage and the help of
the command.
`,
}

CmdHelp is the 'scw help' command

View Source
var Commands = []*Command{
	CmdHelp,

	cmdAttach,
	cmdCommit,
	cmdCp,
	cmdCreate,
	cmdEvents,
	cmdExec,
	cmdHistory,
	cmdImages,
	cmdInfo,
	cmdInspect,
	cmdKill,
	cmdLogin,
	cmdLogout,
	cmdLogs,
	cmdPort,
	cmdPs,
	cmdRename,
	cmdRestart,
	cmdRm,
	cmdRmi,
	cmdRun,
	cmdSearch,
	cmdStart,
	cmdStop,
	cmdTag,
	cmdTop,
	cmdUserdata,
	cmdVersion,
	cmdWait,

	cmdBilling,
	cmdCompletion,
	cmdFlushCache,
	cmdPatch,
	cmdSecurityGroups,
	cmdIPS,
	cmdCS,
}

Commands is the list of enabled CLI commands

Functions

func Start

func Start(rawArgs []string, streams *commands.Streams) (int, error)

Types

type BillingArgs added in v1.5.0

type BillingArgs struct {
	NoTrunc bool
}

BillingArgs are flags for the `RunBilling` function

type Command

type Command struct {
	// Exec executes the command
	Exec func(cmd *Command, args []string) error

	// Usage is the one-line usage message.
	UsageLine string

	// Description is the description of the command
	Description string

	// Help is the full description of the command
	Help string

	// Examples are some examples of the command
	Examples string

	// Flag is a set of flags specific to this command.
	Flag flag.FlagSet

	// Hidden is a flat to hide command from global help commands listing
	Hidden bool

	// API is the interface used to communicate with Scaleway's API
	API *api.ScalewayAPI
	// contains filtered or unexported fields
}

Command contains everything needed by the cli main loop to calls the workflow, display help and usage, and the context

func (*Command) ExamplesHelp

func (c *Command) ExamplesHelp() string

ExamplesHelp returns a string describing examples of the command

func (*Command) GetContext

func (c *Command) GetContext(rawArgs []string) commands.CommandContext

GetContext returns a standard context, with real stdin, stdout, stderr, a configured API and raw arguments

func (*Command) Name

func (c *Command) Name() string

Name returns the command's name

func (*Command) Options

func (c *Command) Options() string

Options returns a string describing options of the command

func (*Command) PrintShortUsage

func (c *Command) PrintShortUsage() error

PrintShortUsage prints a short command usage

func (*Command) PrintUsage

func (c *Command) PrintUsage() error

PrintUsage prints a full command usage

func (*Command) Streams

func (c *Command) Streams() *commands.Streams

type CommandListOpts

type CommandListOpts struct {
	Values *[]string
}

CommandListOpts holds a list of parameters

func NewListOpts

func NewListOpts() CommandListOpts

NewListOpts create an empty CommandListOpts

func (*CommandListOpts) Set

func (opts *CommandListOpts) Set(value string) error

Set appends a new value to a CommandListOpts

func (*CommandListOpts) String

func (opts *CommandListOpts) String() string

String returns a string representation of a CommandListOpts object

Jump to

Keyboard shortcuts

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