Documentation
¶
Overview ¶
Package gitconfig installs and removes the git aliases that make `git create`, `git co` and friends run git-stack. Everything goes through `git config --global`; the file is never edited as text.
Index ¶
- Variables
- type Alias
- type Entry
- type Manager
- func (m *Manager) Apply(ctx context.Context, p Plan, force bool) (installed, skipped []string, err error)
- func (m *Manager) Managed(ctx context.Context) ([]string, error)
- func (m *Manager) Plan(ctx context.Context, aliases []Alias) (Plan, error)
- func (m *Manager) Uninstall(ctx context.Context) (removed, kept []string, err error)
- type Plan
- type Status
Constants ¶
This section is empty.
Variables ¶
var DefaultAliases = []Alias{
{"create", "stack create"},
{"modify", "stack modify"},
{"absorb", "stack absorb"},
{"reorder", "stack reorder"},
{"move", "stack move"},
{"fold", "stack fold"},
{"untrack", "stack untrack"},
{"rename", "stack rename"},
{"track", "stack init"},
{"pop", "stack pop"},
{"restack", "stack restack"},
{"submit", "stack submit"},
{"sync", "stack sync"},
{"up", "stack up"},
{"down", "stack down"},
{"top", "stack top"},
{"bottom", "stack bottom"},
{"continue", "stack continue"},
{"abort", "stack abort"},
{"pr", "stack pr"},
{"undo", "stack undo"},
{"c", "stack create"},
{"m", "stack modify"},
{"ab", "stack absorb"},
{"rs", "stack restack"},
{"ss", "stack submit"},
{"u", "stack up"},
{"d", "stack down"},
{"t", "stack top"},
{"b", "stack bottom"},
{"co", "stack checkout"},
}
DefaultAliases mirrors Graphite's command names and short forms. "checkout" is a git builtin and can never be aliased, hence "co".
Functions ¶
This section is empty.
Types ¶
type Alias ¶
type Alias struct {
Name string
// Command is the part after "git ", e.g. "stack submit".
Command string
}
Alias maps a git alias to a git-stack command.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager plans and applies alias changes.
func (*Manager) Apply ¶
func (m *Manager) Apply(ctx context.Context, p Plan, force bool) (installed, skipped []string, err error)
Apply writes the aliases in the plan. Conflicts are written only when force is set; builtins and shadowing names are always skipped. Every alias written is recorded in stack.managedAliases. It returns the names installed and the names skipped.
type Status ¶
type Status int
Status of one alias in a Plan.
const ( // StatusNew: not set yet. StatusNew Status = iota // StatusSame: already set to our value. StatusSame // StatusConflict: set to a different value. StatusConflict // StatusBuiltin: git would ignore it because a builtin has that name. StatusBuiltin // StatusShadows: an installed git command has that name. StatusShadows )