state

package
v0.24.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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) 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