Documentation
¶
Index ¶
- Constants
- func DefaultTOML() []byte
- func HomeDir() (string, error)
- func HomePath() (string, error)
- func RepoDir() string
- func RepoPath() string
- type AppConfig
- type BranchConfig
- type CommitItem
- type CommitItemOption
- type CommitMessageConfig
- type CommitTypeOption
- type IssueTrackerConfig
- type PushConfig
Constants ¶
const ( SubCommandName = "zf" ProgName = "git-" + SubCommandName )
Variables ¶
This section is empty.
Functions ¶
func DefaultTOML ¶ added in v0.7.0
func DefaultTOML() []byte
DefaultTOML returns the raw embedded default configuration bytes.
func HomeDir ¶ added in v0.5.0
HomeDir returns the configuration directory path in the user home directory where live the config file.
func HomePath ¶ added in v0.5.0
HomePath returns the configuration file path in the user home directory.
Types ¶
type AppConfig ¶
type AppConfig struct {
ProgName string `json:"-" toml:"-" mapstructure:"-"`
ConfigFile string `json:"-" toml:"-" mapstructure:"-"` // path the values were loaded from; "" when none
CommitTypes []CommitTypeOption `json:"commit-types" toml:"commit-types" mapstructure:"commit-types"`
CommitMessage CommitMessageConfig `json:"commit-message" toml:"commit-message" mapstructure:"commit-message"`
Branch BranchConfig `json:"branch" toml:"branch" mapstructure:"branch"`
Push PushConfig `json:"push" toml:"push" mapstructure:"push"`
IssueTracker IssueTrackerConfig `json:"issue-tracker" toml:"issue-tracker" mapstructure:"issue-tracker"`
}
AppConfig is the top-level configuration for the application.
func Load ¶
Load parses the embedded default.toml then overlays any values present in the supplied viper instance. The viper is passed in (rather than read from the package global) so the load has no hidden dependency on prior package state and can be exercised in isolation from a unit test. Each config section is handled individually so that a partial override (e.g. only commit-message.items) preserves unset defaults. viper.Sub is avoided because it silently returns nil for array-typed keys.
type BranchConfig ¶
type BranchConfig struct {
Base string `json:"base" toml:"base" mapstructure:"base"`
Remote string `json:"remote" toml:"remote" mapstructure:"remote"`
UseWorktree *bool `json:"use-worktree" toml:"use-worktree" mapstructure:"use-worktree"`
WorktreeDir string `json:"worktree-dir" toml:"worktree-dir" mapstructure:"worktree-dir"`
}
BranchConfig holds branch-related settings. Base is the branch new branches are cut from; empty means auto-detect. Remote is the git remote name to use; empty means auto-detect.
type CommitItem ¶
type CommitItem struct {
Name string `json:"name" toml:"name" mapstructure:"name"`
Desc string `json:"desc" toml:"desc" mapstructure:"desc"`
Form string `json:"form" toml:"form" mapstructure:"form"`
Required bool `json:"required" toml:"required" mapstructure:"required"`
Options []CommitItemOption `json:"options" toml:"options" mapstructure:"options"`
Value string `json:"-" toml:"-" mapstructure:"-"`
}
CommitItem describes one field in the commit message form. Value is written by the form after the user submits.
type CommitItemOption ¶
type CommitItemOption struct {
Name string `json:"name" toml:"name" mapstructure:"name"`
Desc string `json:"desc" toml:"desc" mapstructure:"desc"`
}
CommitItemOption is a selectable option within a CommitItem select field.
type CommitMessageConfig ¶
type CommitMessageConfig struct {
Items []CommitItem `json:"items" toml:"items" mapstructure:"items"`
Template string `json:"template" toml:"template" mapstructure:"template"`
RefFormat string `json:"ref-format" toml:"ref-format" mapstructure:"ref-format"`
CloseFormat string `json:"close-format" toml:"close-format" mapstructure:"close-format"`
}
CommitMessageConfig holds the ordered list of form fields and the Go template used to assemble the commit message.
type CommitTypeOption ¶
type CommitTypeOption struct {
Name string `json:"name" toml:"name" mapstructure:"name"`
Desc string `json:"desc" toml:"desc" mapstructure:"desc"`
}
CommitTypeOption is a single commit type entry (e.g. "feat", "fix").
type IssueTrackerConfig ¶
type IssueTrackerConfig struct {
Type string `json:"type" toml:"type" mapstructure:"type"`
URL string `json:"url" toml:"url" mapstructure:"url"`
Token string `json:"token" toml:"token" mapstructure:"token"`
Projects []string `json:"projects" toml:"projects" mapstructure:"projects"`
}
IssueTrackerConfig holds connection parameters for one tracker instance. Never log values of this type — Token is a secret.
type PushConfig ¶ added in v0.12.0
type PushConfig struct {
Propose bool `json:"propose" toml:"propose" mapstructure:"propose"`
}
PushConfig holds settings for the post-action push proposal. Propose is the master switch (default true); when false the propose-to-push step is skipped everywhere.