cmd

package
v0.0.0-...-0cf49f2 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2015 License: BSD-3-Clause Imports: 35 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 PasswordFromReader

func PasswordFromReader(reader io.Reader) (string, error)

func ReadTarget

func ReadTarget() (string, error)

func ReadToken

func ReadToken() (string, error)

func SamlCallbackFailureMessage

func SamlCallbackFailureMessage() string

func SamlCallbackSuccessMessage

func SamlCallbackSuccessMessage() string

func ShowServicesInstancesList

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

func StreamJSONResponse

func StreamJSONResponse(w io.Writer, response *http.Response) error

StreamJSONResponse supports the JSON streaming format from the tsuru API.

Types

type APIUser

type APIUser struct {
	Email string
	Teams []string
}

APIUser is a user in the tsuru API.

func GetUser

func GetUser(client *Client) (*APIUser, error)

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

	Verbosity int
	// 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 tsurud 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
}

func (*Context) RawOutput

func (c *Context) RawOutput()

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 DirnameGuesser

type DirnameGuesser struct{}

DirnameGuesser uses the directory name to guess the name of the app

func (DirnameGuesser) GuessName

func (g DirnameGuesser) GuessName(pathname string) (string, 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 MapFlag

type MapFlag map[string]string

func (*MapFlag) Set

func (f *MapFlag) Set(val string) error

func (*MapFlag) String

func (f *MapFlag) String() string

type MultiGuesser

type MultiGuesser struct {
	Guessers []AppGuesser
}

MultiGuesser can use multiple guessers

func (MultiGuesser) GuessName

func (g MultiGuesser) GuessName(pathname string) (string, error)

type Row

type Row []string

type ServiceModel

type ServiceModel struct {
	Service   string
	Instances []string
}

type ShellToContainerCmd

type ShellToContainerCmd struct {
	GuessingCommand
}

func (*ShellToContainerCmd) Info

func (c *ShellToContainerCmd) Info() *Info

func (*ShellToContainerCmd) Run

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

type StringSliceFlag

type StringSliceFlag []string

func (*StringSliceFlag) Set

func (f *StringSliceFlag) Set(val string) error

func (*StringSliceFlag) String

func (f *StringSliceFlag) String() 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) Reverse

func (t *Table) Reverse()

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