pretty

package
v0.0.0-...-21f80b0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bold

func Bold(str string) string

Bold returns the provided string with bold style

func Colorize

func Colorize(text string, tag string, style Style) string

Colorize colorizes the provided text according to the tag and style. If style != FullStyle, this function does nothing.

func Emojify

func Emojify(tag string) string

Emojify prepends the tag string with an emoji

func PrettyBlame

func PrettyBlame(blame *blame.LineBlame, ageLimit int, style Style) string

PrettyBlame returns a string with the format

[John Doe]

If the commit is older than ageLimit (in days), the format is

[OLD John Doe]

Color is added according to the style.

func PrettyFilename

func PrettyFilename(path string, nComments int, style Style) string

PrettyFilename returns a string with the format

  • tests/generic_code.py (10 comments)

The string if formatted according to the provided style (colorful or black-and-white).

func PrettyLineNumber

func PrettyLineNumber(number int, maxDigits int) string

PrettyLineNumber returns a string with the format

[Line 123]

The string is padded according to the maximum number of digits (maxDigits) to ensure vertical alignment between line numbers of the same file.

func PrettySummary

func PrettySummary(counter map[string]int, style Style) string

Types

type Style

type Style int

Style used to print to stdout

const (
	FullStyle Style = iota
	BWStyle
	PlainStyle
)

func GetStyle

func GetStyle(bw bool, plain bool) (Style, error)

GetStyle returns the style that should be used. FullStyle is the default. If bw, then BWStyle. If plain, then PlainStyle.

If the output (stdout) is redirected, PlainStyle is always used.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL