cliconfig

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Verbose enables verbose output.
	Verbose bool `mapstructure:"verbose"`
	// Quiet suppresses all output except for errors.
	Quiet bool `mapstructure:"quiet"`
	// Sandbox enables macOS sandbox mode, which restricts file access.
	Sandbox bool `mapstructure:"sandbox"`
	// OneKeyMap is the path to the main onekeymap configuration file.
	OneKeyMap string `mapstructure:"onekeymap"`
	// OtelExporterOtlpEndpoint is the OpenTelemetry OTLP exporter endpoint.
	OtelExporterOtlpEndpoint string `mapstructure:"otel.exporter.otlp.endpoint"`
	// ServerListen is the server listen address (e.g., "tcp://127.0.0.1:50051" or "unix:///tmp/onekeymap.sock").
	ServerListen string `mapstructure:"server.listen"`
	// Editors holds configuration for different editors.
	Editors map[string]EditorConfig `mapstructure:"editors"`
}

func NewConfig

func NewConfig(cmd *cobra.Command) (*Config, error)

NewConfig initializes and returns a new Config object. It sets defaults, binds environment variables, reads config files, and unmarshals the result.

func (*Config) Validate

func (c *Config) Validate() error

Validate checks if the configuration is valid.

type EditorConfig

type EditorConfig struct {
	// KeymapPath is the path to the editor's keymap file.
	KeymapPath string `mapstructure:"keymap_path"`
	// TODO(xinnjie): Sync command is not implement yet
	// SyncEnabled specifies whether keymap syncing is enabled for this editor.
	SyncEnabled bool `mapstructure:"sync_enabled"`
}

EditorConfig holds per-editor configuration settings.

Jump to

Keyboard shortcuts

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