cmd

package
v0.0.0-...-266c88a Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2015 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	X_Megam_EMAIL       = "X-Megam-EMAIL"
	X_Megam_APIKEY      = "X-Megam-APIKEY"
	X_Megam_DATE        = "X-Megam-DATE"
	X_Megam_HMAC        = "X-Megam-HMAC"
	API_GATEWAY_VERSION = "/v1"
	Content_Type        = "Content-Type"

	Accept = "Accept"
)

Variables

This section is empty.

Functions

func CalcBase64

func CalcBase64(data string) string

func CalcHMAC

func CalcHMAC(secret string, message string) string

func Colorfy

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

func ExtractProgramName

func ExtractProgramName(path string) string

func GetMD5Hash

func GetMD5Hash(text []byte) string

func GetURL

func GetURL(path string) (string, error)

Types

type Authly

type Authly struct {
	UrlSuffix string
	Date      string
	Email     string
	APIKey    string
	JSONBody  []byte
	AuthMap   map[string]string
}

func NewAuthly

func NewAuthly(urlsuffix string, jsonbody []byte) (*Authly, error)

func (*Authly) AuthHeader

func (authly *Authly) AuthHeader() error

type Client

type Client struct {
	HTTPClient *http.Client

	Authly *Authly
	// 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 Context

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

type FlaggedCommand

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

type Info

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

type Manager

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

func BuildBaseManager

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

func NewManager

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

func (*Manager) Register

func (m *Manager) Register(command Command)

func (*Manager) Run

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

type Row

type Row []string

type Table

type Table struct {
	Headers Row
	// 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) 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