state

package
v0.27.1 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BrowserOpener added in v0.25.0

type BrowserOpener func(url string) error

BrowserOpener opens a URL in the user's default browser.

type State

type State struct {
	Version string
	Config  *config.Config
	Logger  *slog.Logger
	// contains filtered or unexported fields
}

State holds shared dependencies for all commands.

func New

func New(version string) *State

New creates a new State with the given version string.

func (*State) AccountID

func (s *State) AccountID() (string, error)

AccountID returns the configured account ID or an error.

func (*State) Client

func (s *State) Client(ctx context.Context) (*qcloudapi.Client, error)

Client returns the gRPC client, creating it lazily on first call.

func (*State) OpenBrowser added in v0.25.0

func (s *State) OpenBrowser(url string) error

OpenBrowser opens the given URL in the user's default browser.

func (*State) SetBrowserOpener added in v0.25.0

func (s *State) SetBrowserOpener(fn BrowserOpener)

SetBrowserOpener injects a browser opener, bypassing the default. For testing.

func (*State) SetClient

func (s *State) SetClient(c *qcloudapi.Client)

SetClient injects a pre-built client, bypassing lazy creation.

func (*State) SetUpdater added in v0.5.0

func (s *State) SetUpdater(u Updater)

SetUpdater injects an Updater implementation.

func (*State) Updater added in v0.5.0

func (s *State) Updater() (Updater, error)

Updater returns the CLI updater, creating it lazily on first call.

type Updater added in v0.5.0

type Updater interface {
	DetectLatest(ctx context.Context) (*selfupgrade.ReleaseInfo, bool, error)
	UpdateSelf(ctx context.Context, currentVersion string) (*selfupgrade.ReleaseInfo, error)
}

Updater checks for and applies CLI updates.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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