Documentation
¶
Overview ¶
Package config provides configuration for kickoff.
Index ¶
Constants ¶
const ( // DefaultProjectHost denotes the default git host that is passed to // templates so that project related urls can be rendered in files like // READMEs. DefaultProjectHost = "github.com" // DefaultRepositoryName is the name of the default skeleton repository. DefaultRepositoryName = "default" // DefaultSkeletonName is the name of the default skeleton in a repository. DefaultSkeletonName = "default" // NoLicense means that no license file will be generated for a new // project. NoLicense = "none" // NoGitignore means that no .gitignore file will be generated for a new // project. NoGitignore = "none" )
Variables ¶
var ( // LocalConfigDir points to the user's local configuration dir which is // platform specific. LocalConfigDir = configdir.LocalConfig("kickoff") // DefaultConfigPath holds the default kickof config path in the user's // local config directory. DefaultConfigPath = filepath.Join(LocalConfigDir, "config.yaml") // DefaultRepositoryURL is the url of the default skeleton repository if // the user did not configure anything else. DefaultRepositoryURL = "https://github.com/martinohmann/kickoff-skeletons" )
Functions ¶
Types ¶
type Config ¶
type Config struct {
Project Project `json:"project"`
Repositories map[string]string `json:"repositories"`
Values template.Values `json:"values"`
}
Config is the type for user-defined configuration.
func (*Config) ApplyDefaults ¶
func (c *Config) ApplyDefaults()
ApplyDefaults applies default values to the config.
func (*Config) MergeFromFile ¶
MergeFromFile loads the config from path and merges it into c. Returns any errors that may occur during loading or merging. Non-zero fields in c will not be overridden if present in the file at path.
type Project ¶
type Project struct {
Host string `json:"host"`
Owner string `json:"owner"`
Name string `json:"-"`
License string `json:"license"`
Gitignore string `json:"gitignore"`
}
Project contains project specific configuration like git host, owner and project name.
func (*Project) ApplyDefaults ¶
func (p *Project) ApplyDefaults()
ApplyDefaults applies defaults to unset fields. If the Owner field is empty ApplyDefaults will attempt to fill it with the git config values of github.user or user.name if exists.
func (*Project) GoPackagePath ¶
GoPackagePath returns a string that can be used as a Golang package path for the project.
func (*Project) HasGitignore ¶
HasGitignore returns true if a gitignore template is specified in the project config. If true, the project creator will write the gitignore template into the .gitignore file in the project's output directory.
func (*Project) HasLicense ¶
HasLicense returns true if an open source license is specified in the project config. If true, the project creator will write the text of the provided license into the LICENSE file in the project's output directory.