common

package
v0.12.13 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OutputFormatPlain = "plain"
	OutputFormatJSON  = "json"
)

Variables

This section is empty.

Functions

func ParseGPUUUIDs

func ParseGPUUUIDs(raw string) []string

ParseGPUUUIDs parses a comma-separated string of GPU UUIDs and returns a slice of trimmed UUIDs. Empty strings and strings with only spaces are filtered out.

func ParseOutputFormat added in v0.11.0

func ParseOutputFormat(raw string) (string, error)

ParseOutputFormat validates and normalizes output format values. Empty values default to plain output.

func ResolveDataDir added in v0.9.0

func ResolveDataDir(cliContext *cli.Context) (string, error)

ResolveDataDir resolves the data directory using the --data-dir flag when provided, otherwise it falls back to the default GPUd data directory selection logic.

func StateFileFromContext added in v0.9.0

func StateFileFromContext(cliContext *cli.Context) (string, error)

StateFileFromContext returns the state file path derived from the resolved data directory.

func VersionFileFromContext added in v0.9.0

func VersionFileFromContext(cliContext *cli.Context, flagValue string, flagSet bool) (string, error)

VersionFileFromContext returns the version file path, honoring user overrides.

func WrapOutputError added in v0.11.0

func WrapOutputError(outputFormat, code string, err error) error

func WriteJSON added in v0.11.0

func WriteJSON(v any) error

func WriteJSONToWriter added in v0.11.0

func WriteJSONToWriter(w io.Writer, v any) error

Types

type JSONCommandError added in v0.11.0

type JSONCommandError struct {
	// contains filtered or unexported fields
}

func AsJSONCommandError added in v0.11.0

func AsJSONCommandError(err error) (*JSONCommandError, bool)

func NewJSONCommandError added in v0.11.0

func NewJSONCommandError(code string, message string, exitCode int) *JSONCommandError

func (*JSONCommandError) Code added in v0.11.0

func (e *JSONCommandError) Code() string

func (*JSONCommandError) Error added in v0.11.0

func (e *JSONCommandError) Error() string

func (*JSONCommandError) ExitStatus added in v0.11.0

func (e *JSONCommandError) ExitStatus() int

func (*JSONCommandError) Response added in v0.11.0

type JSONCommandErrorPayload added in v0.11.0

type JSONCommandErrorPayload struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

type JSONCommandErrorResponse added in v0.11.0

type JSONCommandErrorResponse struct {
	Error JSONCommandErrorPayload `json:"error"`
}

Jump to

Keyboard shortcuts

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