Help us shape the future of Go! Take the 2026 Go Developer Survey

internal

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Version is set with -X by its package path in .goreleaser.yml, the Dockerfile and flake.nix, so moving or renaming it needs the same change there. The linker ignores an -X that does not resolve.

Functions

func First added in v0.2.0

func First[T any](items iter.Seq2[T, error], n int) iter.Seq2[T, error]

func ListWorkspace added in v0.2.0

func ListWorkspace(ctx context.Context) (*string, error)

ListWorkspace is the workspace the session works in, which a listing keeps to as every other command does, and nil where the session works in none.

func ResolveClient

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

ResolveClient and ResolveSession are the only places a meshStack client is built, so every command resolves the same global flags as settings.

func ResolveClientOptions added in v0.2.0

func ResolveClientOptions(modifiers ...ResolveClientOptionsModifier) (opts auth.ResolveClientOptions)

func ResolveSession

func ResolveSession(ctx context.Context, modifiers ...ResolveClientOptionsModifier) (auth.Session, error)

func SettingSources

func SettingSources() setting.Sources

func SkipVersionCheck added in v0.3.0

func SkipVersionCheck(opts *auth.ResolveClientOptions)

SkipVersionCheck is for a call whose failure only leaves something out: the version checks call meshStack and GitHub, and warn where they fail.

func UuidArg added in v0.3.0

func UuidArg(id *uuid.UUID) cobra.PositionalArgs

Types

type ExitError added in v0.3.0

type ExitError struct {
	Code int
	Err  error
}

ExitError makes cmd/meshstack exit with Code rather than 1, such as the exit code of a command it ran.

func (ExitError) Error added in v0.3.0

func (e ExitError) Error() string

func (ExitError) Unwrap added in v0.3.0

func (e ExitError) Unwrap() error

type Flag

type Flag[T string | bool | uuid.UUID] struct {
	Name          FlagName
	Shorthand     string
	Help          string
	Value         T
	SettingEnvKey string
}

func NewFlagForSetting

func NewFlagForSetting[T string | bool | uuid.UUID](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 no value while predicate holds, but stays a source, so that setting resolution can still name the flag in an error.

func (*Flag[T]) Register

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

func (Flag[T]) WithShorthand added in v0.3.0

func (flag Flag[T]) WithShorthand(shorthand string) Flag[T]

type FlagName

type FlagName string

func (FlagName) SourceDescription

func (n FlagName) SourceDescription() string

func (FlagName) String

func (n FlagName) String() string

type KindCommand added in v0.3.0

type KindCommand string

func KindCommandOf added in v0.3.0

func KindCommandOf(name string) KindCommand

func (KindCommand) Aliases added in v0.3.0

func (command KindCommand) Aliases() []string

func (KindCommand) Long added in v0.3.0

func (command KindCommand) Long(short string) string

type LimitFlag added in v0.2.0

type LimitFlag int

func (*LimitFlag) Set added in v0.2.0

func (f *LimitFlag) Set(value string) error

func (*LimitFlag) String added in v0.2.0

func (f *LimitFlag) String() string

func (*LimitFlag) Type added in v0.2.0

func (f *LimitFlag) Type() string

type ListFlags added in v0.2.0

type ListFlags struct {
	// contains filtered or unexported fields
}

func (*ListFlags) Register added in v0.2.0

func (f *ListFlags) Register(flags *pflag.FlagSet)

func (*ListFlags) Run added in v0.2.0

func (f *ListFlags) Run[M any](cmd *cobra.Command, filter any) error

Run lists the objects of M that filter narrows.

func (*ListFlags) RunSeq added in v0.3.0

func (f *ListFlags) RunSeq(cmd *cobra.Command, list func(ctx context.Context, meshStack client.Client, options client.ListOptions) iter.Seq2[jsontext.Value, error]) error

RunSeq is Run for a listing that is not one kind's, such as the runs of every building block.

type ListResult added in v0.3.0

type ListResult struct {
	// Limit is 0 for unlimited.
	Limit, Listed int
	Total         *int
	Defaulted     bool
}

func (ListResult) CutShortNote added in v0.3.0

func (r ListResult) CutShortNote() string

type OutputFlag added in v0.2.0

type OutputFlag struct{ Format OutputFormat }

OutputFlag implements pflag.Value, so an unknown format is rejected while the flags are parsed rather than after the first page arrived.

func (*OutputFlag) Register added in v0.2.0

func (f *OutputFlag) Register(flags *pflag.FlagSet)

func (*OutputFlag) RegisterForItem added in v0.3.0

func (f *OutputFlag) RegisterForItem(flags *pflag.FlagSet)

RegisterForItem is Register for a command that writes one object through OutputFormat.WriteItem.

func (*OutputFlag) Set added in v0.2.0

func (f *OutputFlag) Set(value string) error

func (*OutputFlag) String added in v0.2.0

func (f *OutputFlag) String() string

func (*OutputFlag) Type added in v0.2.0

func (f *OutputFlag) Type() string

type OutputFormat added in v0.2.0

type OutputFormat string
const (
	OutputJson     OutputFormat = "json"
	OutputNdjson   OutputFormat = "ndjson"
	OutputMarkdown OutputFormat = "markdown"
)

func (OutputFormat) WriteItem added in v0.3.0

func (format OutputFormat) WriteItem(w io.Writer, item jsontext.Value) error

func (OutputFormat) WriteList added in v0.3.0

func (format OutputFormat) WriteList(w io.Writer, items iter.Seq2[jsontext.Value, error]) error

WriteList leaves a listing that fails part way through unterminated, so that json output which stopped early does not parse as a complete array.

type ResolveClientOptionsModifier added in v0.3.0

type ResolveClientOptionsModifier func(*auth.ResolveClientOptions)

func WithSettingSources added in v0.3.0

func WithSettingSources(sources setting.Sources) ResolveClientOptionsModifier

type ShowFlag added in v0.3.0

type ShowFlag struct{ Format OutputFormat }

func (*ShowFlag) Json added in v0.3.0

func (f *ShowFlag) Json() bool

Json output is read by a script, so a command must not prompt for anything then.

func (*ShowFlag) Register added in v0.3.0

func (f *ShowFlag) Register(flags *pflag.FlagSet)

func (*ShowFlag) Set added in v0.3.0

func (f *ShowFlag) Set(value string) error

func (*ShowFlag) Show added in v0.3.0

func (f *ShowFlag) Show(w io.Writer, markdownTemplate *template.Template, data any) error

func (*ShowFlag) String added in v0.3.0

func (f *ShowFlag) String() string

func (*ShowFlag) Type added in v0.3.0

func (f *ShowFlag) Type() string

type UuidFlag added in v0.3.0

type UuidFlag uuid.UUID

UuidFlag and UuidArg reject a malformed uuid while cobra parses the command line. meshStack answers one with an empty list or a 404, which says nothing about a typo.

func (*UuidFlag) Set added in v0.3.0

func (f *UuidFlag) Set(value string) error

func (*UuidFlag) String added in v0.3.0

func (f *UuidFlag) String() string

func (*UuidFlag) Type added in v0.3.0

func (f *UuidFlag) Type() string

Directories

Path Synopsis
Package color decides how much color the CLI writes, so that the Markdown a command shows and the log agree.
Package color decides how much color the CLI writes, so that the Markdown a command shows and the log agree.
Package prompt asks a person on the terminal.
Package prompt asks a person on the terminal.

Jump to

Keyboard shortcuts

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