Documentation ¶
Index ¶
- Variables
- func DiskDir(name string) (string, error)
- func Disks() ([]string, error)
- func GetSSHAddress(instName string) (string, error)
- func GetWslStatus(instName string) (string, error)
- func InstanceDir(name string) (string, error)
- func Instances() ([]string, error)
- func LoadYAMLByFilePath(filePath string) (*limayaml.LimaYAML, error)
- func PrintInstances(w io.Writer, instances []*Instance, format string, options *PrintOptions) error
- func ReadPIDFile(path string) (int, error)
- type Disk
- type FormatData
- type Instance
- type PrintOptions
- type Status
Constants ¶
This section is empty.
Variables ¶
var FormatHelp = "\n" + "These functions are available to go templates:\n\n" + textutil.IndentString(2, strings.Join(textutil.FuncHelp, "\n")+"\n")
Functions ¶
func GetSSHAddress ¶ added in v0.18.0
func GetWslStatus ¶ added in v0.18.0
GetWslStatus runs `wsl --list --verbose` and parses its output. There are several possible outputs, all listed with their whitespace preserved output below.
(1) Expected output if at least one distro is installed: PS > wsl --list --verbose
NAME STATE VERSION
* Ubuntu Stopped 2
(2) Expected output when no distros are installed, but WSL is configured properly: PS > wsl --list --verbose Windows Subsystem for Linux has no installed distributions.
Use 'wsl.exe --list --online' to list available distributions and 'wsl.exe --install <Distro>' to install.
Distributions can also be installed by visiting the Microsoft Store: https://aka.ms/wslstore Error code: Wsl/WSL_E_DEFAULT_DISTRO_NOT_FOUND
(3) Expected output when no distros are installed, and WSL2 has no kernel installed:
PS > wsl --list --verbose Windows Subsystem for Linux has no installed distributions. Distributions can be installed by visiting the Microsoft Store: https://aka.ms/wslstore
func InstanceDir ¶
InstanceDir returns the instance dir. InstanceDir does not check whether the instance exists
func LoadYAMLByFilePath ¶
LoadYAMLByFilePath loads and validates the yaml.
func PrintInstances ¶ added in v0.15.0
PrintInstances prints instances in a requested format to a given io.Writer. Supported formats are "json", "yaml", "table", or a go template
func ReadPIDFile ¶ added in v0.7.0
ReadPIDFile returns 0 if the PID file does not exist or the process has already terminated (in which case the PID file will be removed).
Types ¶
type Disk ¶ added in v0.14.0
type Disk struct { Name string `json:"name"` Size int64 `json:"size"` Dir string `json:"dir"` Instance string `json:"instance"` InstanceDir string `json:"instanceDir"` MountPoint string `json:"mountPoint"` }
func InspectDisk ¶ added in v0.14.0
type FormatData ¶ added in v0.8.0
type FormatData struct { Instance HostOS string HostArch string LimaHome string IdentityFile string }
func AddGlobalFields ¶ added in v0.8.0
func AddGlobalFields(inst *Instance) (FormatData, error)
type Instance ¶
type Instance struct { Name string `json:"name"` Status Status `json:"status"` Dir string `json:"dir"` VMType limayaml.VMType `json:"vmType"` Arch limayaml.Arch `json:"arch"` CPUType string `json:"cpuType"` CPUs int `json:"cpus,omitempty"` Memory int64 `json:"memory,omitempty"` // bytes Disk int64 `json:"disk,omitempty"` // bytes Message string `json:"message,omitempty"` AdditionalDisks []limayaml.Disk `json:"additionalDisks,omitempty"` Networks []limayaml.Network `json:"network,omitempty"` SSHLocalPort int `json:"sshLocalPort,omitempty"` SSHConfigFile string `json:"sshConfigFile,omitempty"` HostAgentPID int `json:"hostAgentPID,omitempty"` DriverPID int `json:"driverPID,omitempty"` Errors []error `json:"errors,omitempty"` Config *limayaml.LimaYAML `json:"config,omitempty"` SSHAddress string `json:"sshAddress,omitempty"` Protected bool `json:"protected"` }
func Inspect ¶
Inspect returns err only when the instance does not exist (os.ErrNotExist). Other errors are returned as *Instance.Errors