Documentation
¶
Overview ¶
Package defaults provides functionality for loading and saving global default settings for Wails projects. Settings are stored in ~/.config/wails/defaults.yaml
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetConfigDir ¶
GetConfigDir returns the path to the Wails config directory
func GetDefaultsPath ¶
GetDefaultsPath returns the path to the defaults.yaml file
func Save ¶
func Save(defaults GlobalDefaults) error
Save saves the global defaults to the config file
Types ¶
type AuthorDefaults ¶
type AuthorDefaults struct {
Name string `json:"name" yaml:"name"`
Company string `json:"company" yaml:"company"`
}
AuthorDefaults contains the author's information
type GlobalDefaults ¶
type GlobalDefaults struct {
// Author information
Author AuthorDefaults `json:"author" yaml:"author"`
// Default project settings
Project ProjectDefaults `json:"project" yaml:"project"`
}
GlobalDefaults represents the user's default project settings These are stored in ~/.config/wails/defaults.yaml and used when creating new projects
func Load ¶
func Load() (GlobalDefaults, error)
Load loads the global defaults from the config file Returns default values if the file doesn't exist
func (*GlobalDefaults) GenerateCopyright ¶
func (d *GlobalDefaults) GenerateCopyright() string
GenerateCopyright generates a copyright string from the template
func (*GlobalDefaults) GenerateDescription ¶
func (d *GlobalDefaults) GenerateDescription(projectName string) string
GenerateDescription generates a description string from the template
func (*GlobalDefaults) GenerateProductIdentifier ¶
func (d *GlobalDefaults) GenerateProductIdentifier(projectName string) string
GenerateProductIdentifier generates a product identifier from prefix and project name
func (*GlobalDefaults) GetDefaultVersion ¶
func (d *GlobalDefaults) GetDefaultVersion() string
GetDefaultVersion returns the default version or the fallback
type ProjectDefaults ¶
type ProjectDefaults struct {
// ProductIdentifierPrefix is the prefix for app identifiers (e.g., "com.mycompany")
ProductIdentifierPrefix string `json:"productIdentifierPrefix" yaml:"productIdentifierPrefix"`
// DefaultTemplate is the default frontend template to use
DefaultTemplate string `json:"defaultTemplate" yaml:"defaultTemplate"`
// Copyright template - can include {year} and {company} placeholders
CopyrightTemplate string `json:"copyrightTemplate" yaml:"copyrightTemplate"`
// Description template for new projects - can include {name} placeholder
DescriptionTemplate string `json:"descriptionTemplate" yaml:"descriptionTemplate"`
// Default product version for new projects
DefaultVersion string `json:"defaultVersion" yaml:"defaultVersion"`
}
ProjectDefaults contains default project settings