stdcli

package
v1.0.0-alpha.6 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2017 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Binary   string
	Version  string
	Commands []*cli.Command

	Stack404 error
)

Functions

func AddCommand

func AddCommand(cmd *cli.Command)

func CheckFlagsPresence

func CheckFlagsPresence(c *cli.Context, flags ...string)

func CurrentStack

func CurrentStack() string

func EnsureOnlyFlags

func EnsureOnlyFlags(c *cli.Context, args []string)

EnsureOnlyFlags ensures that every element in the args slice starts with --

func Error

func Error(err error)

func FlagsToOptions

func FlagsToOptions(c *cli.Context, args []string) map[string]string

FlagsToOptions converts a list of '--key=value'/'--bool' strings to 'key: value, bool: true'-style map

func GetAppSetting

func GetAppSetting(setting string) string

func GetAppStack

func GetAppStack() string

func GetAuthOrDie

func GetAuthOrDie() (*Auth, *Apprc)

Exits if there is any error.

func HandlePanicErr

func HandlePanicErr(err error)

func New

func New() *cli.App

func ReadSetting

func ReadSetting(name, setting string) string

func RmSettingDir

func RmSettingDir(path string) error

func SetAuth

func SetAuth(a *Auth) error

func Usage

func Usage(c *cli.Context)

Usage prints help for the current command and exits

func WriteAppSetting

func WriteAppSetting(setting, value string) error

func WriteSetting

func WriteSetting(name, setting, value string) error

Types

type Apprc

type Apprc struct {
	Context string  `json:"context,omitempty"`
	Auths   []*Auth `json:"auths,omitempty"`
}

func LoadApprc

func LoadApprc() (*Apprc, error)

func (*Apprc) DeleteAuth

func (rc *Apprc) DeleteAuth() error

func (*Apprc) GetAuth

func (rc *Apprc) GetAuth() *Auth

func (*Apprc) SetAuth

func (rc *Apprc) SetAuth(a *Auth) error

func (*Apprc) Write

func (rc *Apprc) Write() error

type Auth

type Auth struct {
	Name      string `json:"name,omitempty"`
	ApiServer string `json:"api_server,omitempty"`
	ApiKey    string `json:"api_key,omitempty"`
	Project   string `json:"project,omitempty"` // for gcp only
	Bucket    string `json:"bucket,omitempty"`
	Region    string `json:"region,omitempty"` // for aws only
}

func GetAuthOrAnon

func GetAuthOrAnon() (*Auth, bool)

Exits if there is any error.

func NewAnonAUth

func NewAnonAUth() *Auth

func (*Auth) Provider

func (a *Auth) Provider() string

Jump to

Keyboard shortcuts

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