assetconfig

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigFilePath

func ConfigFilePath() string

ConfigFilePath returns the full path to asset-config.json under the user's home directory. Initialised once on first call.

func IsEnabled

func IsEnabled(id string) (bool, error)

IsEnabled checks if a specific asset is enabled.

func Save

func Save(cfg *AssetConfig) error

Save writes the asset config to disk.

Types

type AssetConfig

type AssetConfig struct {
	Version string       `json:"version"`
	Assets  []AssetEntry `json:"assets"`
}

AssetConfig holds the full configuration.

func Load

func Load() (*AssetConfig, error)

Load reads the asset config from disk. Returns defaults if file doesn't exist.

func SetAssetEnabled

func SetAssetEnabled(id string, enabled bool) (*AssetConfig, error)

SetAssetEnabled sets the enabled state of an asset by ID.

func ToggleAsset

func ToggleAsset(id string) (*AssetConfig, error)

ToggleAsset flips the enabled state of an asset by ID.

type AssetEntry

type AssetEntry struct {
	ID            string `json:"id"`
	Name          string `json:"name"`
	Enabled       bool   `json:"enabled"`
	Installed     bool   `json:"installed"`
	Category      string `json:"category"`
	Description   string `json:"description"`
	DocURL        string `json:"doc_url,omitempty"`
	ReferencePath string `json:"reference_path,omitempty"`
}

AssetEntry represents a single asset plugin entry.

func DefaultAssets

func DefaultAssets() []AssetEntry

DefaultAssets returns the built-in list of known asset plugins.

func GetEnabledAssets

func GetEnabledAssets() ([]AssetEntry, error)

GetEnabledAssets returns all enabled asset entries.

Jump to

Keyboard shortcuts

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