cli

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: Apache-2.0 Imports: 35 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 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