util

package
v3.0.0-beta+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2018 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrNoNamespaces chkitErrors.Err = "no namespaces in account"
)
View Source
const (
	// ErrUnableToSaveConfig -- unable to save config
	ErrUnableToSaveConfig chkitErrors.Err = "unable to save config"
)

Variables

This section is empty.

Functions

func ExitOnErr

func ExitOnErr(log *logrus.Logger, err error)

ExitOnErr -- logs error and exit program

func GetClient

func GetClient(ctx *cli.Context) *chClient.Client

GetClient -- extract chkit Client

func GetConfig

func GetConfig(ctx *cli.Context) model.Config

GetConfig -- exctract config structure from Context

func GetConfigPath

func GetConfigPath(ctx *cli.Context) string

GetConfigPath -- exctract config path from Context

func GetFirstClientNamespace

func GetFirstClientNamespace(ctx *cli.Context) (string, error)

GetFirstClientNamespace -- fetches namespace list and returns first element. Needed for login.

func GetNamespace

func GetNamespace(ctx *cli.Context) string

GetNamespace -- return namespace for usage in commands. Priority: "namespace" flag, config file.

func GetTokens

func GetTokens(ctx *cli.Context) model.Tokens

GetTokens -- extract tokens from Context

func GetVersion

func GetVersion(ctx *cli.Context) semver.Version

func LoadConfig

func LoadConfig(configFilePath string, config *model.Config) error

LoadConfig -- loads config from fs

func LoadTokens

func LoadTokens(ctx *cli.Context) (model.Tokens, error)

LoadTokens -- loads tokens from fs

func LogFileName

func LogFileName() string

func SaveConfig

func SaveConfig(ctx *cli.Context) error

SaveConfig -- writes config in config path

func SaveTokens

func SaveTokens(ctx *cli.Context, tokens model.Tokens) error

SaveTokens -- save tokens in config path

func SetClient

func SetClient(ctx *cli.Context, client *chClient.Client)

SetClient -- store Client in Context

func SetConfig

func SetConfig(ctx *cli.Context, config model.Config)

SetConfig -- store config in Context

func SetTokens

func SetTokens(ctx *cli.Context, tokens model.Tokens)

SetTokens -- stores tokens in Context

func StoreClient

func StoreClient(ctx *cli.Context, client *chClient.Client)

func WriteConfig

func WriteConfig(ctx *cli.Context) error

WriteConfig -- writes config from Context to config dir

func WriteData

func WriteData(ctx *cli.Context, renderer model.Renderer) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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