stdcli

package
v1.0.0-alpha.19 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Binary      string
	Commands    []cli.Command
	LocalAppDir string
	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 ExitOnError

func ExitOnError(err error)

func ExitOnErrorf

func ExitOnErrorf(msg string, args ...interface{})

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 GetAuthContextOrDie

func GetAuthContextOrDie(stack string) (*Auth, *Apprc)

Exits if there is any error.

func GetAuthOrDie

func GetAuthOrDie(c *cli.Context) (*Auth, *Apprc)

Exits if there is any error.

func HandlePanicErr

func HandlePanicErr(err error, token, version string)

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(stack string) *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"`
	Provider  string `json:"provider,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

Jump to

Keyboard shortcuts

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