Documentation
¶
Index ¶
- Variables
- func CutShortNote(limit, listed int, total *int, defaulted bool) string
- func First[T any](items iter.Seq2[T, error], n int) iter.Seq2[T, error]
- func ListWorkspace(ctx context.Context) (*string, error)
- func ResolveClient(ctx context.Context) (client.Client, error)
- func ResolveClientOptions() auth.ResolveClientOptions
- func SettingSources() setting.Sources
- func WriteList(w io.Writer, format OutputFormat, items iter.Seq2[jsontext.Value, error]) error
- type Flag
- type FlagName
- type LimitFlag
- type ListFlags
- type OutputFlag
- type OutputFormat
Constants ¶
This section is empty.
Variables ¶
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) )
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 CutShortNote ¶ added in v0.2.0
CutShortNote says that a listing stopped at its limit before the end, and is empty for a listing that is complete.
func ListWorkspace ¶ added in v0.2.0
ListWorkspace is the workspace a listing is narrowed to, or nil for none. It leaves out the profile's default workspace, so that a listing asked for no workspace shows what the credential can see.
func ResolveClient ¶
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 ResolveClientOptions ¶ added in v0.2.0
func ResolveClientOptions() auth.ResolveClientOptions
func SettingSources ¶
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 (*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.
type ListFlags ¶ added in v0.2.0
type ListFlags struct {
// contains filtered or unexported fields
}
ListFlags are the flags every list command takes, and Run is how each one lists.
type OutputFlag ¶ added in v0.2.0
type OutputFlag struct{ Format OutputFormat }
OutputFlag registers --output and holds what it was set to. It 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) 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
OutputFormat is what a list command writes its items as.
const ( OutputJson OutputFormat = "json" OutputNdjson OutputFormat = "ndjson" )