config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const AppName = "lametric-cli"

Variables

This section is empty.

Functions

func ConfigExists

func ConfigExists() (bool, error)

ConfigExists checks whether the config file exists on disk.

func ConfigPath

func ConfigPath() (string, error)

func Dir

func Dir() (string, error)

func EnsureDir

func EnsureDir() (string, error)

func EnsureKeyringDir

func EnsureKeyringDir() (string, error)

func KeyringDir

func KeyringDir() (string, error)

func WriteConfig

func WriteConfig(cfg File) error

WriteConfig writes the YAML config file atomically using a .tmp + rename pattern.

Types

type Device

type Device struct {
	IP string `yaml:"ip" json:"ip"`
}

Device holds connection details for a single LaMetric device.

type File

type File struct {
	DefaultDevice  string            `yaml:"default_device,omitempty" json:"default_device,omitempty"`
	Devices        map[string]Device `yaml:"devices,omitempty" json:"devices,omitempty"`
	Output         Output            `yaml:"output,omitempty" json:"output,omitempty"`
	KeyringBackend string            `yaml:"keyring_backend,omitempty" json:"keyring_backend,omitempty"`
}

File represents the lametric-cli YAML configuration.

func ReadConfig

func ReadConfig() (File, error)

ReadConfig reads the YAML config file. Returns zero File{} if file does not exist.

func (File) DeviceByAlias

func (f File) DeviceByAlias(alias string) (Device, error)

DeviceByAlias returns the device for the given alias. If alias is empty, the default device is used.

type Output

type Output struct {
	Color string `yaml:"color,omitempty" json:"color,omitempty"`
}

Output holds output preferences.

Jump to

Keyboard shortcuts

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