config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultDownloadPath     = "./downloads"
	DefaultFilenameTemplate = "{author} - {title}_{id}"
)
View Source
const DefaultConfigFileMode = constants.PrivateFileMode

Variables

This section is empty.

Functions

func ConfigFilePath

func ConfigFilePath() (string, error)

func EnvValue

func EnvValue(spec SettingSpec) (string, bool)

func RefreshTokenFromEnv

func RefreshTokenFromEnv() string

func SetConfigValue

func SetConfigValue(path, alias string, value parser.Value) error

func SetFilePathForTest

func SetFilePathForTest(configPath string) func()

func UnsetConfigValue

func UnsetConfigValue(path, alias string) (bool, error)

func ValidSettingAliases

func ValidSettingAliases() []string

func WritePrivateFile

func WritePrivateFile(path string, body []byte) error

Types

type RuntimeConfig

type RuntimeConfig struct {
	RefreshToken       string
	DownloadPath       string
	FilenameTemplate   string
	HTTPSProxy         string
	WebFallbackEnabled bool
	UpdateCheckEnabled bool
	OutputJSON         bool
	LoginOpenBrowser   bool
	LoginTimeout       time.Duration
	LoginUseAfterLogin bool
}

type SettingSpec

type SettingSpec struct {
	Alias      string
	KoanfKey   string
	Table      []string
	Key        string
	Kind       settingKind
	HasDefault bool
	Default    any
}

func SettingSpecByAlias

func SettingSpecByAlias(alias string) (SettingSpec, bool)

type SettingValue

type SettingValue struct {
	Value    any
	Text     string
	Source   string
	HasValue bool
}

func ParseSettingInput

func ParseSettingInput(alias, raw string) (SettingValue, parser.Value, error)

type SettingsState

type SettingsState struct {
	// contains filtered or unexported fields
}

func LoadSettingsState

func LoadSettingsState() (SettingsState, error)

func (SettingsState) Effective

func (s SettingsState) Effective(alias string) (SettingValue, error)

func (SettingsState) Runtime

func (s SettingsState) Runtime() (RuntimeConfig, error)

Jump to

Keyboard shortcuts

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