internal

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultTimeout = 45 * time.Second

Variables

View Source
var (
	SkipVersionCheckFlag = NewFlagForSetting[bool]("skip-version-check", setting.SkipVersionCheck)
	EndpointFlag         = NewFlagForSetting[string]("endpoint", setting.Endpoint)
	WorkspaceFlag        = NewFlagForSetting[string]("workspace", setting.Workspace)
	ProfileFlag          = NewFlagForSetting[string]("profile", setting.Profile)
)
View Source
var Version = devVersion

Version identifies the CLI to the meshStack API through the client's UserAgent. A release overrides it with -ldflags "-X github.com/meshcloud/meshstack-cli/cmd/internal.Version=<tag>".

Functions

func ResolveClient

func ResolveClient(ctx context.Context) (client.Client, error)

ResolveClient is the only place a client is built, so every command sends the same user agent and resolves the same global flags as settings.

func ResolveSession

func ResolveSession(ctx context.Context, options ...ResolveSessionOption) (auth.Session, error)

func RunWith

func RunWith(ctx context.Context, timeout time.Duration, action func(context.Context) error) error

func SettingSources

func SettingSources() setting.Sources

Types

type Flag

type Flag[T string | bool] struct {
	Name  FlagName
	Help  string
	Value T
	// SettingEnvKey is required to use the Flag as a setting.FrontendSource.
	SettingEnvKey string
}

func NewFlagForSetting

func NewFlagForSetting[T string | bool](name FlagName, s setting.Setting) Flag[T]

func (*Flag[T]) AsSource

func (flag *Flag[T]) AsSource() setting.FrontendSource

func (*Flag[T]) AsSourceUnless

func (flag *Flag[T]) AsSourceUnless(predicate func(T) bool) setting.FrontendSource

AsSourceUnless contributes nothing but its own name while the flag still carries the placeholder. The source is registered anyway, so setting resolution can name it in its error.

func (*Flag[T]) Register

func (flag *Flag[T]) Register(flags *pflag.FlagSet) (flagName string)

type FlagName

type FlagName string

func (FlagName) SourceDescription

func (n FlagName) SourceDescription() string

func (FlagName) String

func (n FlagName) String() string

type ResolveSessionOption

type ResolveSessionOption func(*auth.ResolveSessionOptions)

Jump to

Keyboard shortcuts

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