utils

package
v0.6.19 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeHostPort added in v0.6.14

func ComputeHostPort(containerName string) int

ComputeHostPort returns the host port that docker.sh assigns to a container. Matches the get_host_port function in docker.sh exactly.

func FindRuntimeVersionDir

func FindRuntimeVersionDir(base string, entries []os.DirEntry, version string) (string, error)

get a runtime version directory

func FormatName

func FormatName(s string) string

FormatName converts a string to a lowercase URL-safe slug (e.g., "My App v2.0 (Beta)" -> "my-app-v2-0-beta").

func GetDataDir

func GetDataDir() string

func GetRuntimePath

func GetRuntimePath(runtime, version string, tools ...string) (map[string]string, error)

getRuntimePath finds the runtime binary in ~/.version-fox/cache/<runtime>

func GetVfox

func GetVfox() (string, error)

finds vfox executable

func PrintColoredLogLine

func PrintColoredLogLine(line, colorReset, colorRed, colorYellow, colorBlue, colorGray, colorGreen string)

Types

type BlockDevice

type BlockDevice struct {
	Name        string   `json:"name"`
	Size        string   `json:"size"`
	Type        string   `json:"type"`
	Mountpoints []string `json:"mountpoints,omitempty"`
}

type BuildInfo

type BuildInfo struct {
	Version   string `json:"version"`
	Commit    string `json:"commit"`
	BuildDate string `json:"build_date"`
	GoVersion string `json:"go_version"`
}

type DiskUsage

type DiskUsage struct {
	Filesystem string `json:"filesystem"`
	Size       string `json:"size"`
	Used       string `json:"used"`
	Available  string `json:"available"`
	UsePercent string `json:"use_percent"`
	Mountpoint string `json:"mountpoint"`
}

type HardwareInfo

type HardwareInfo struct {
	OS        string  `json:"os"`
	Arch      string  `json:"arch"`
	Kernel    *string `json:"kernel,omitempty"`
	Hostname  *string `json:"hostname,omitempty"`
	CPUCount  int     `json:"cpu_count"`
	MemTotal  *string `json:"mem_total,omitempty"`
	MemUsed   *string `json:"mem_used,omitempty"`
	MemFree   *string `json:"mem_free,omitempty"`
	SwapTotal *string `json:"swap_total,omitempty"`
	SwapUsed  *string `json:"swap_used,omitempty"`
}

type StorageInfo

type StorageInfo struct {
	Partitions []DiskUsage   `json:"partitions,omitempty"`
	Devices    []BlockDevice `json:"devices,omitempty"`
}

type SystemInfo

type SystemInfo struct {
	Build   BuildInfo    `json:"build"`
	HW      HardwareInfo `json:"hardware"`
	Storage StorageInfo  `json:"storage"`
}

func GetSystemInfo

func GetSystemInfo() (SystemInfo, error)

Jump to

Keyboard shortcuts

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