config

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureConfigDir

func EnsureConfigDir() error

EnsureConfigDir creates the config directory if it doesn't exist.

func GetConfigPath

func GetConfigPath() (string, error)

GetConfigPath returns the full path to the config file.

func Save

func Save(cfg *Config) error

Save writes the config to the config file.

Types

type AddConfig

type AddConfig struct {
	Open bool `yaml:"open"`
}

AddConfig represents the configuration for the add command.

type CloseConfig added in v0.3.0

type CloseConfig struct {
	Force bool `yaml:"force"`
}

CloseConfig represents the configuration for the close command.

type Config

type Config struct {
	Add    AddConfig   `yaml:"add"`
	Close  CloseConfig `yaml:"close"`
	Rm     RmConfig    `yaml:"rm"`
	Editor string      `yaml:"editor,omitempty"`
}

Config represents the application configuration.

func Load

func Load() (*Config, error)

Load reads and parses the config file.

func LoadOrDefault

func LoadOrDefault() *Config

LoadOrDefault loads the config file, or returns default config if it doesn't exist.

func NewConfig

func NewConfig() *Config

NewConfig returns a new Config with default values.

func (*Config) GetEditor

func (c *Config) GetEditor() string

GetEditor returns the editor command if add.open is true, otherwise empty string.

func (*Config) MergeWithFlags

func (c *Config) MergeWithFlags(openFlag *bool, editorFlag *string, closeYesFlag *bool, rmYesFlag *bool) *Config

MergeWithFlags merges the configuration with command-line flags. Flags take precedence over config file values.

func (*Config) Validate

func (c *Config) Validate() error

Validate checks if the configuration is valid.

type RmConfig added in v0.3.0

type RmConfig struct {
	Force bool `yaml:"force"`
}

RmConfig represents the configuration for the rm command.

Jump to

Keyboard shortcuts

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