preferences

package
v1.0.77 Latest Latest
Warning

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

Go to latest
Published: May 3, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ChromePath = Key{
	ID:           "chrome_path",
	Name:         "Chrome Path",
	KeyType:      StandardKey,
	ValueType:    StringValue,
	DefaultValue: "",
	Description:  "Custom path to Chrome executable. Leave blank to use default.",
}
View Source
var ExportPathKey = Key{
	ID:           "export_path",
	Name:         "Export Path",
	KeyType:      DirectoryPathKey,
	ValueType:    StringValue,
	DefaultValue: filex.GetCWD(),
	Description:  "The path where exported cards will be saved",
}
View Source
var ExportTemplateKey = Key{
	ID:           "export_template",
	Name:         "Export Template",
	KeyType:      StandardKey,
	ValueType:    StringValue,
	DefaultValue: "{{SOURCE}}_{{PLATFORM_ID}}.png",
	Description:  "The template used to generate the filename of exported cards. Available tokens: " + templateTokenDescription,
}
View Source
var LastLoadedVaultKey = Key{
	ID:           "last_loaded_vault",
	Name:         "Last Vault",
	KeyType:      StandardKey,
	ValueType:    StringValue,
	DefaultValue: "",
	Description:  "The name of the last vault loaded into the application.",
}
View Source
var MaxExportSizeKey = Key{
	ID:           "max_export_size",
	Name:         "Max Export Size",
	KeyType:      StandardKey,
	ValueType:    IntegerValue,
	DefaultValue: 3072,
	Description:  "The maximum size of the exported card PNG (if either width or height is greater than this value, the card will be scaled down, preserving aspect ratio, with the biggest dimension being this value)",
}
View Source
var RenderMdHTML = Key{
	ID:           "render_md_html",
	Name:         "Render Markdown/HTML",
	KeyType:      StandardKey,
	ValueType:    BoolValue,
	DefaultValue: false,
	Description:  "Allow rendering of Markdown and HTML in card sheet",
}

Functions

This section is empty.

Types

type Key

type Key struct {
	ID           string
	Name         string
	KeyType      KeyType
	DefaultValue any
	ValueType    ValueType
	Description  string
}

type KeyType

type KeyType byte
const (
	StandardKey KeyType = iota
	DirectoryPathKey
	FilePathKey
)

type Options

type Options struct {
	Path string
	Type Type
}

Options configures the preferences service

type Service

type Service interface {
	Keys() []Key
	RegisterKey(key Key)
	GetAll() map[string]any
	SetAll(data map[string]any)
	Get(key Key) any
	Set(key Key, value any)
	GetString(key Key) string
	SetString(key Key, value string)
	GetInt(key Key) int
	SetInt(key Key, value int)
	GetBool(key Key) bool
	SetBool(key Key, value bool)
	RestoreDefaults()
	Save() error
}

Service manages application preferences

type Type

type Type string

Type is the configuration file format

const (
	YAML Type = "yaml"
	JSON Type = "json"
)

type ValueType

type ValueType byte
const (
	IntegerValue ValueType = iota
	StringValue
	BoolValue
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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