config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AliasesPath

func AliasesPath() string

AliasesPath returns the full path to the aliases file.

func CacheDir

func CacheDir() string

CacheDir returns the cache directory (~/.cache/notion/). Respects XDG_CACHE_HOME if set.

func ConfigDir

func ConfigDir() string

ConfigDir returns the config directory (~/.config/notion/). Respects XDG_CONFIG_HOME if set.

func ConfigPath

func ConfigPath() string

ConfigPath returns the full path to the config file.

func EnsureDirs

func EnsureDirs() error

EnsureDirs creates config and cache directories if they don't exist. Directories are created with 0o700 permissions.

Types

type Config

type Config struct {
	DefaultProfile string             `toml:"default_profile"`
	DefaultOutput  string             `toml:"default_output,omitempty"` // table|json|plain
	CacheTTL       Duration           `toml:"cache_ttl"`
	Verbose        bool               `toml:"verbose,omitempty"`
	Profiles       map[string]Profile `toml:"profiles"`
}

Config is the top-level configuration.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns config with sensible defaults.

func Load

func Load() (*Config, error)

Load reads config from the default path. Returns default config if the file doesn't exist.

func LoadFrom

func LoadFrom(path string) (*Config, error)

LoadFrom reads config from a specific path.

func (*Config) GetProfile

func (c *Config) GetProfile(name string) (Profile, error)

GetProfile returns the named profile or an error if not found.

func (*Config) Save

func (c *Config) Save() error

Save writes config to the default path with 0o600 permissions.

func (*Config) SaveTo

func (c *Config) SaveTo(path string) error

SaveTo writes config to a specific path.

func (*Config) SetProfile

func (c *Config) SetProfile(name string, p Profile)

SetProfile stores a profile by name.

type Duration

type Duration struct{ time.Duration }

Duration wraps time.Duration for TOML marshalling.

func (Duration) MarshalText

func (d Duration) MarshalText() ([]byte, error)

func (*Duration) UnmarshalText

func (d *Duration) UnmarshalText(text []byte) error

type Profile

type Profile struct {
	// Token is stored in keyring, not config. This field is only used
	// for non-keyring scenarios (e.g., CI with env vars).
	Token string `toml:"token,omitempty"`
}

Profile holds per-profile configuration.

Jump to

Keyboard shortcuts

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