common

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvVarPrefix       = "AK_"
	ConfigYAMLFileName = "config.yaml"
)
View Source
const (
	NotFoundExitCode   = 10
	NotAMemberExitCode = NotFoundExitCode
	FailedPrecondition = 64
	GenericFailure     = 1
)

Variables

This section is empty.

Functions

func AddFailIfError added in v0.3.0

func AddFailIfError(cmd *cobra.Command)

func AddFailIfNotFoundFlag

func AddFailIfNotFoundFlag(cmd *cobra.Command)

func Build added in v0.3.2

func Build(rts sdkservices.Runtimes, srcFS fs.FS, paths []string, syms []sdktypes.Symbol) (*sdkbuildfile.BuildFile, error)

func BuildProject added in v0.4.0

func BuildProject(project string, dirPaths, filePaths []string) (sdktypes.BuildID, error)

func Client

func Client() sdkservices.Services

func Config

func Config() *svc.Config

func ConfigYAMLFilePath

func ConfigYAMLFilePath() string

func Consume added in v0.2.0

func Consume(args []string) (data []byte, path string, err error)

func FailIfError added in v0.3.0

func FailIfError(cmd *cobra.Command, err error, what string) error

func FailIfNotFound

func FailIfNotFound(cmd *cobra.Command, what string, found bool) error

func FailNotFound added in v0.2.0

func FailNotFound(cmd *cobra.Command, what string) error

func InitConfig

func InitConfig(confmap map[string]any) (err error)

func InitRPCClient

func InitRPCClient(url string, authToken string)

func JSONRenderer

func JSONRenderer(o any)

func LimitedContext

func LimitedContext() (context.Context, context.CancelFunc)

func NiceJSONRenderer

func NiceJSONRenderer(o any)

func Render

func Render(o any)

func RenderKV

func RenderKV(k string, v any)

func RenderKVIfV

func RenderKVIfV[T any](k string, v T)

func RenderList

func RenderList[T fmt.Stringer](ts []T)

func SetRenderer

func SetRenderer(r Renderer)

func StandardCommand

func StandardCommand(cmd *cobra.Command) *cobra.Command

func TextRenderer

func TextRenderer(o any)

func ToExitCodeError added in v0.3.0

func ToExitCodeError(err error, what string) error

func WithLimitedContext added in v0.4.0

func WithLimitedContext(ctx context.Context) (context.Context, context.CancelFunc)

TODO(ENG-320): Configuration to disable timeout for debugging.

Types

type ExitCodeError

type ExitCodeError struct {
	Err  error
	Code int
}

func NewExitCodeError

func NewExitCodeError(code int, err error) ExitCodeError

func (ExitCodeError) Error

func (e ExitCodeError) Error() string

type KV

type KV struct {
	K string
	V any
}

func (KV) MarshalJSON

func (kv KV) MarshalJSON() ([]byte, error)

func (KV) Text

func (kv KV) Text() string

type KVIfV

type KVIfV[T any] struct {
	K string
	V T
}

This will not print anything if V is nil for text rendering. Should make output parsing easier for get operations. TODO: should we even care for non-json output parsing?

func (KVIfV[T]) MarshalJSON

func (kv KVIfV[T]) MarshalJSON() ([]byte, error)

func (KVIfV[T]) Text

func (kv KVIfV[T]) Text() string

type Renderer

type Renderer func(any)

type Texter

type Texter interface{ Text() string }

Jump to

Keyboard shortcuts

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