cli

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Overview

Package cli defines the cobra commands. Commands only parse flags and call functions in other internal packages; they hold no business logic.

Index

Constants

View Source
const DefaultContextName = "default"

DefaultContextName is the name used by 'config set' without --name.

View Source
const DefaultUpTimeout = 10 * time.Minute

DefaultUpTimeout covers the first start, which pulls about 2 GB of images.

View Source
const DefaultWorkspaceContext = "local"

DefaultWorkspaceContext is the context name init gives a workspace.

Variables

This section is empty.

Functions

func Execute

func Execute(ctx context.Context, args []string, s Streams) int

Execute runs the CLI with args and returns the process exit code.

Types

type App

type App struct {
	Opts    GlobalOptions
	Streams Streams
	Printer *output.Printer
	Log     *slog.Logger
	// contains filtered or unexported fields
}

App is the state shared by commands during one execution.

func (*App) Color

func (a *App) Color() bool

Color reports whether text output may use colors.

func (*App) Interactive

func (a *App) Interactive() bool

Interactive reports whether commands may prompt the user.

type ConfigSetResult

type ConfigSetResult struct {
	Name     string `json:"name"`
	System   string `json:"system"`
	URL      string `json:"url"`
	User     string `json:"user"`
	Store    string `json:"store"`
	Current  bool   `json:"current"`
	Verified bool   `json:"verified"`
}

ConfigSetResult is the outcome of 'config set'.

func (ConfigSetResult) WriteText

func (r ConfigSetResult) WriteText(w io.Writer) error

type ContextList

type ContextList struct {
	Current  string        `json:"current,omitempty"`
	Contexts []ContextView `json:"contexts"`
}

ContextList is the result of 'config list'.

func (ContextList) WriteText

func (l ContextList) WriteText(w io.Writer) error

type ContextView

type ContextView struct {
	Name      string                  `json:"name"`
	Kind      string                  `json:"kind"`
	Current   bool                    `json:"current"`
	Workspace string                  `json:"workspace,omitempty"`
	Endpoints map[string]EndpointView `json:"endpoints,omitempty"`
}

ContextView is a context as shown by 'config get' and 'config list'.

func (ContextView) WriteText

func (v ContextView) WriteText(w io.Writer) error

type EndpointView

type EndpointView struct {
	URL      string `json:"url"`
	Username string `json:"username"`
	Insecure bool   `json:"insecure,omitempty"`
	Password string `json:"password"`
}

EndpointView is an endpoint with its password masked, or shown with --show-secrets.

type GlobalOptions

type GlobalOptions struct {
	Output         string
	Dir            string
	Context        string
	NonInteractive bool
	Verbose        bool
	NoColor        bool
}

GlobalOptions holds the flags shared by every command.

type Plugin added in v0.5.0

type Plugin struct {
	Name string `json:"name"`
	Path string `json:"path"`
	// Shadowed is true when a built-in command has the same name, so the plugin never runs.
	Shadowed bool `json:"shadowed"`
}

Plugin is one plugin found on PATH.

type PluginListResult added in v0.5.0

type PluginListResult struct {
	Plugins []Plugin `json:"plugins"`
}

PluginListResult is the outcome of 'plugin list'.

func (PluginListResult) WriteText added in v0.5.0

func (r PluginListResult) WriteText(w io.Writer) error

type SkillContent added in v0.4.0

type SkillContent struct {
	Name    string `json:"name"`
	Content string `json:"content"`
}

SkillContent is the result of 'skill show'. The text output is the file itself.

func (SkillContent) WriteText added in v0.4.0

func (s SkillContent) WriteText(w io.Writer) error

type SkillInstallResult added in v0.4.0

type SkillInstallResult struct {
	Path   string `json:"path"`
	Action string `json:"action"`
}

SkillInstallResult is the outcome of 'skill install'.

func (SkillInstallResult) WriteText added in v0.4.0

func (r SkillInstallResult) WriteText(w io.Writer) error

type Streams

type Streams struct {
	In  io.Reader
	Out io.Writer
	Err io.Writer
}

Streams holds the standard streams used by commands.

type UpgradeResult

type UpgradeResult struct {
	From      string        `json:"from"`
	To        string        `json:"to"`
	Status    stack.Status  `json:"status"`
	SmokeTest *smoke.Report `json:"smokeTest,omitempty"`
}

UpgradeResult is the outcome of 'upgrade'.

func (UpgradeResult) WriteText

func (r UpgradeResult) WriteText(w io.Writer) error

type UserChange

type UserChange struct {
	Action   string `json:"action"`
	Username string `json:"username"`
	// Restart is true: OpenArch reads the users file only at startup.
	Restart bool `json:"restartNeeded"`
}

UserChange is the result of 'users add', 'set-password' and 'delete'.

func (UserChange) WriteText

func (c UserChange) WriteText(w io.Writer) error

type UserList

type UserList struct {
	Users []UserView `json:"users"`
}

UserList is the result of 'users list'.

func (UserList) WriteText

func (l UserList) WriteText(w io.Writer) error

type UserView

type UserView struct {
	Username  string   `json:"username"`
	ID        string   `json:"id"`
	Admin     bool     `json:"admin"`
	Groups    []string `json:"groups"`
	Email     string   `json:"email,omitempty"`
	FirstName string   `json:"firstName,omitempty"`
	LastName  string   `json:"lastName,omitempty"`
	// Workspace marks the admin user of the workspace, whose password is in .env.local.
	Workspace bool `json:"workspaceAdmin,omitempty"`
}

UserView is a user as shown by the users commands. It never has the password.

type Whoami

type Whoami struct {
	Context     string       `json:"context,omitempty"`
	Workspace   string       `json:"workspace,omitempty"`
	URL         string       `json:"url"`
	User        string       `json:"user"`
	HasPassword bool         `json:"hasPassword"`
	Insecure    bool         `json:"insecure,omitempty"`
	Sources     auth.Sources `json:"sources"`
}

Whoami is the result of 'config whoami'. It never holds a password.

func (Whoami) WriteText

func (w Whoami) WriteText(out io.Writer) error

Jump to

Keyboard shortcuts

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