util

package
v3.10.8 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2023 License: Apache-2.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package util contains methods used across all cli commands @todo: get rid of os.Exits and use errors instread

Index

Constants

View Source
const (
	// EnvLocal is a builtin environment, it represents your local `micro server`
	EnvLocal = "local"
	// EnvPlatform is a builtin highly available environment in the cloud,
	EnvPlatform = "platform"
)

Variables

This section is empty.

Functions

func AddEnv

func AddEnv(env Env) error

AddEnv for cli

func CLIProxyAddress

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

CLIProxyAddress returns the proxy address which should be set for the client

func CliError

func CliError(err error) cli.ExitCoder

CliError returns a user friendly message from error. If we can't determine a good one returns an error with code 128

func DelEnv

func DelEnv(ctx *cli.Context, envName string) error

DelEnv deletes an env from config

func IsBuiltInService

func IsBuiltInService(command string) bool

IsBuiltInService check service type

func IsPlatform

func IsPlatform(ctx *cli.Context) bool

IsPlatform check platform type

func Print

func Print(e Exec) func(*cli.Context) error

Print for Exec

func SetEnv

func SetEnv(envName string) error

SetEnv selects an environment to be used.

Types

type Env

type Env struct {
	Name         string
	ProxyAddress string
	Description  string
}

Env for cli

func GetEnv

func GetEnv(ctx *cli.Context) (Env, error)

GetEnv returns the current selected environment Does not take

func GetEnvByName

func GetEnvByName(env string) (Env, error)

GetEnvByName for service

func GetEnvs

func GetEnvs() ([]Env, error)

GetEnvs List env

type Exec

type Exec func(*cli.Context, []string) ([]byte, error)

Exec for ctx

Jump to

Keyboard shortcuts

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