Documentation ¶
Index ¶
- Variables
- func ColorizeDiff(diff string) string
- type Cmd
- type CmdRepo
- func (r *CmdRepo) CheckoutNewBranch(branchName string) error
- func (r *CmdRepo) Close() error
- func (r *CmdRepo) CreateCommit(message string) (Commit, error)
- func (r *CmdRepo) CurrentBranch() string
- func (r *CmdRepo) DiffChanges() (string, error)
- func (r *CmdRepo) DiffStaged() (string, error)
- func (r *CmdRepo) Directory() string
- func (r *CmdRepo) MainBranch() string
- func (r *CmdRepo) PushChanges() error
- func (r *CmdRepo) StageChanges() error
- type Commit
- type Committer
- type Credentials
- type Git
- type Repo
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ColorDiffTrippleDash is the "file name before change", e.g: // --- a/cmd/apply.go ColorDiffTrippleDash = color.New(color.FgHiRed, color.Italic) // ColorDiffTripplePlus is the "file name after change", e.g: // +++ b/cmd/apply.go ColorDiffTripplePlus = color.New(color.FgHiGreen, color.Italic) // ColorDiffRemove is the removed lines, e.g: // - if !color.NoColor && cfg.Log.Format == config.LogFormatPretty { // - diff = colorizeDiff(diff) ColorDiffRemove = color.New(color.FgRed) // ColorDiffAdd is the added lines, e.g: // + if cfg.Log.Format == config.LogFormatPretty { // + diff = git.ColorizeDiff(diff) ColorDiffAdd = color.New(color.FgGreen) // ColorDiffDoubleAt is the double at-symbol (@) specifying section ranges, e.g: // @@ -339,42 +338,12 @@ func logDiff(repo git.Repo) { ColorDiffDoubleAt = color.New(color.FgMagenta, color.Italic) // ColorDiffOtherNonSpace is the other Git info lines, i.e all other lines // that doesn't start with a space, e.g: // diff --git a/cmd/apply.go b/cmd/apply.go // index b4c2d30..a5f6e5f 100644 ColorDiffOtherNonSpace = color.New(color.FgHiBlack, color.Italic) )
Color settings for Git diffs.
Example diff:
diff --git a/cmd/apply.go b/cmd/apply.go index b4c2d30..a5f6e5f 100644 --- a/cmd/apply.go +++ b/cmd/apply.go @@ -339,42 +338,12 @@ func logDiff(repo git.Repo) { log.Warn().Err(err).Msg("Failed diffing changes. Trying to continue anyways.") return } - if !color.NoColor && cfg.Log.Format == config.LogFormatPretty { - diff = colorizeDiff(diff) + if cfg.Log.Format == config.LogFormatPretty { + diff = git.ColorizeDiff(diff)
Functions ¶
func ColorizeDiff ¶
Types ¶
type Cmd ¶
type Cmd struct { Credentials Credentials Committer Committer }
Cmd implements Git using the command-line version of Git.
type CmdRepo ¶
type CmdRepo struct { Committer Committer // contains filtered or unexported fields }
func (*CmdRepo) CheckoutNewBranch ¶
func (*CmdRepo) CurrentBranch ¶
func (*CmdRepo) DiffChanges ¶
func (*CmdRepo) DiffStaged ¶ added in v0.5.0
func (*CmdRepo) MainBranch ¶
func (*CmdRepo) PushChanges ¶
func (*CmdRepo) StageChanges ¶
type Commit ¶
type Credentials ¶
Click to show internal directories.
Click to hide internal directories.