config

package
v1.6.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindStruct added in v1.5.2

func BindStruct(file *File, key string, dst any) error

func DecodeTo added in v1.5.2

func DecodeTo(file *File, dst any) error

func GetByPath added in v1.5.2

func GetByPath(file *File, key string) (any, bool)

func IsNotExist

func IsNotExist(err error) bool

func OSConfigPath

func OSConfigPath(homeDir, goos string, lookupEnv func(string) (string, bool)) string

func ResolveConfigPath

func ResolveConfigPath() (string, error)

func ResolveWritablePath

func ResolveWritablePath() (string, error)

func Save

func Save(path string, file *File) error

func SetByPath added in v1.5.2

func SetByPath(file *File, key string, value any) error

Types

type APICacheSection added in v1.5.1

type APICacheSection struct {
	Enable    *bool `toml:"enable" mapstructure:"enable"`
	CacheTime *int  `toml:"cache_time" mapstructure:"cache_time"`
}

type CLIOverrides

type CLIOverrides struct {
	ExtractAll       *bool
	AssetFilters     *[]string
	CacheDir         *string
	ProxyURL         *string
	DownloadOnly     *bool
	File             *string
	GithubToken      *string
	IsGUI            *bool
	Name             *string
	Quiet            *bool
	ShowHash         *bool
	Source           *bool
	SourcePath       *string
	System           *string
	Tag              *string
	Target           *string
	UpgradeOnly      *bool
	Verify           *string
	DisableSSL       *bool
	ChunkConcurrency *int
}

type File

type File struct {
	Meta struct {
		Keys []string
	}
	Global   Section         `toml:"global" mapstructure:"global"`
	ApiCache APICacheSection `toml:"api_cache" mapstructure:"api_cache"`
	Ghproxy  GhproxySection  `toml:"ghproxy" mapstructure:"ghproxy"`
	Repos    map[string]Section
	Packages map[string]Section `toml:"packages" mapstructure:"packages"`
}

func Load

func Load() (*File, error)

func LoadFile

func LoadFile(path string) (*File, error)

func LoadFromEnvOrDefault

func LoadFromEnvOrDefault(lookupEnv func(string) (string, bool), homeDir, goos string) (*File, string, error)

func NewFile

func NewFile() *File

type GhproxySection added in v1.5.1

type GhproxySection struct {
	Enable     *bool    `toml:"enable" mapstructure:"enable"`
	HostURL    *string  `toml:"host_url" mapstructure:"host_url"`
	SupportAPI *bool    `toml:"support_api" mapstructure:"support_api"`
	Fallbacks  []string `toml:"fallbacks" mapstructure:"fallbacks"`
}

type Merged

type Merged struct {
	ExtractAll       bool
	AssetFilters     []string
	CacheDir         string
	ProxyURL         string
	DownloadOnly     bool
	File             string
	GithubToken      string
	GuiTarget        string
	IsGUI            bool
	Name             string
	Quiet            bool
	ShowHash         bool
	Source           bool
	SourcePath       string
	Sys7zPath        string
	System           string
	Tag              string
	Target           string
	UpgradeOnly      bool
	Verify           string
	DisableSSL       bool
	ChunkConcurrency int
}

func MergeInstallOptions

func MergeInstallOptions(global, repo, pkg Section, cli CLIOverrides) Merged

type Section

type Section struct {
	ExtractAll           *bool    `toml:"extract_all" mapstructure:"extract_all"`
	AssetFilters         []string `toml:"asset_filters" mapstructure:"asset_filters"`
	CacheDir             *string  `toml:"cache_dir" mapstructure:"cache_dir"`
	ProxyURL             *string  `toml:"proxy_url" mapstructure:"proxy_url"`
	DownloadOnly         *bool    `toml:"download_only" mapstructure:"download_only"`
	File                 *string  `toml:"file" mapstructure:"file"`
	GithubToken          *string  `toml:"github_token" mapstructure:"github_token"`
	GuiTarget            *string  `toml:"gui_target" mapstructure:"gui_target"`
	IgnoreUpdatePackages []string `toml:"ignore_update_packages" mapstructure:"ignore_update_packages"`
	IsGUI                *bool    `toml:"is_gui" mapstructure:"is_gui"`
	Name                 *string  `toml:"name" mapstructure:"name"`
	Quiet                *bool    `toml:"quiet" mapstructure:"quiet"`
	Repo                 *string  `toml:"repo" mapstructure:"repo"`
	ShowHash             *bool    `toml:"show_hash" mapstructure:"show_hash"`
	Source               *bool    `toml:"download_source" mapstructure:"download_source"`
	SourcePath           *string  `toml:"source_path" mapstructure:"source_path"`
	Sys7zPath            *string  `toml:"sys7z_path" mapstructure:"sys7z_path"`
	System               *string  `toml:"system" mapstructure:"system"`
	Tag                  *string  `toml:"tag" mapstructure:"tag"`
	Target               *string  `toml:"target" mapstructure:"target"`
	UpgradeOnly          *bool    `toml:"upgrade_only" mapstructure:"upgrade_only"`
	Verify               *string  `toml:"verify_sha256" mapstructure:"verify_sha256"`
	DisableSSL           *bool    `toml:"disable_ssl" mapstructure:"disable_ssl"`
	ChunkConcurrency     *int     `toml:"chunk_concurrency" mapstructure:"chunk_concurrency"`
	BatchConcurrency     *int     `toml:"batch_concurrency" mapstructure:"batch_concurrency"`
}

Jump to

Keyboard shortcuts

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