cmd

package
v0.0.0-...-4eaaba6 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2014 License: BSD-3-Clause Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAbortCommand = gerrors.New("")

Functions

func Colorfy

func Colorfy(msg string, fontcolor string, background string, effect string) string

func ExtractProgramName

func ExtractProgramName(path string) string

func GetURL

func GetURL(path string) (string, error)

func JoinWithUserDir

func JoinWithUserDir(p ...string) string

func MergeFlagSet

func MergeFlagSet(fs1, fs2 *gnuflag.FlagSet) *gnuflag.FlagSet

func ReadTarget

func ReadTarget() (string, error)

func ReadToken

func ReadToken() (string, error)

func ShowServicesInstancesList

func ShowServicesInstancesList(b []byte) ([]byte, error)

Types

type AdminCommandable

type AdminCommandable interface {
	AdminCommands() []Command
}

Implementing the AdminCommandable interface allows extending the tsuru-admin command line interface

type AppGuesser

type AppGuesser interface {
	GuessName(path string) (string, error)
}

AppGuesser is used to guess the name of an app based in a file path.

type Client

type Client struct {
	HTTPClient *http.Client
	// contains filtered or unexported fields
}

func NewClient

func NewClient(client *http.Client, context *Context, manager *Manager) *Client

func (*Client) Do

func (c *Client) Do(request *http.Request) (*http.Response, error)

type Command

type Command interface {
	Info() *Info
	Run(context *Context, client *Client) error
}

type Commandable

type Commandable interface {
	Commands() []Command
}

Implementing the Commandable interface allows extending the tsr command line interface

type ConfirmationCommand

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

func (*ConfirmationCommand) Confirm

func (cmd *ConfirmationCommand) Confirm(context *Context, question string) bool

func (*ConfirmationCommand) Flags

func (cmd *ConfirmationCommand) Flags() *gnuflag.FlagSet

type Context

type Context struct {
	Args   []string
	Stdout io.Writer
	Stderr io.Writer
	Stdin  io.Reader
}

type DeprecatedCommand

type DeprecatedCommand struct {
	Command
	// contains filtered or unexported fields
}

func (*DeprecatedCommand) Flags

func (c *DeprecatedCommand) Flags() *gnuflag.FlagSet

func (*DeprecatedCommand) Run

func (c *DeprecatedCommand) Run(context *Context, client *Client) error

type FlaggedCommand

type FlaggedCommand interface {
	Command
	Flags() *gnuflag.FlagSet
}

type GitGuesser

type GitGuesser struct{}

GitGuesser uses git to guess the name of the app.

It reads the "tsuru" remote from git config file. If the remote does not exist, or does not match the tsuru pattern (<user>@<somehost>:<app-name>.git), GuessName will return an error.

func (GitGuesser) GuessName

func (g GitGuesser) GuessName(path string) (string, error)

type GuessingCommand

type GuessingCommand struct {
	G AppGuesser
	// contains filtered or unexported fields
}

Embed this struct if you want your command to guess the name of the app.

func (*GuessingCommand) Flags

func (cmd *GuessingCommand) Flags() *gnuflag.FlagSet

func (*GuessingCommand) Guess

func (cmd *GuessingCommand) Guess() (string, error)

type Info

type Info struct {
	Name    string
	MinArgs int
	MaxArgs int
	Usage   string
	Desc    string
}

type Lookup

type Lookup func(context *Context) error

type Manager

type Manager struct {
	Commands map[string]Command
	// contains filtered or unexported fields
}

func BuildBaseManager

func BuildBaseManager(name, version, versionHeader string, lookup Lookup) *Manager

func NewManager

func NewManager(name, ver, verHeader string, stdout, stderr io.Writer, stdin io.Reader, lookup Lookup) *Manager

func (*Manager) Register

func (m *Manager) Register(command Command)

func (*Manager) RegisterDeprecated

func (m *Manager) RegisterDeprecated(command Command, oldName string)

func (*Manager) RegisterTopic

func (m *Manager) RegisterTopic(name, content string)

func (*Manager) Run

func (m *Manager) Run(args []string)

type Row

type Row []string

type ServiceModel

type ServiceModel struct {
	Service   string
	Instances []string
}

type Table

type Table struct {
	Headers       Row
	LineSeparator bool
	// contains filtered or unexported fields
}

func NewTable

func NewTable() *Table

func (*Table) AddRow

func (t *Table) AddRow(row Row)

func (*Table) Bytes

func (t *Table) Bytes() []byte

func (*Table) Rows

func (t *Table) Rows() int

func (*Table) Sort

func (t *Table) Sort()

Sort sorts the rows in the table using the first column as key.

func (*Table) SortByColumn

func (t *Table) SortByColumn(column int)

func (*Table) String

func (t *Table) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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