wakabox

package
v0.0.0-...-ddfde4e Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BarStyle = map[string][]rune{
	"SOLIDLT":    []rune(`░▏▎▍▌▋▊▉█`),
	"SOLIDMD":    []rune(`▒▏▎▍▌▋▊▉█`),
	"SOLIDDK":    []rune(`▓▏▎▍▌▋▊▉█`),
	"EMPTY":      []rune(` ▏▎▍▌▋▊▉█`),
	"UNDERSCORE": []rune(`▁▏▎▍▌▋▊▉█`),
}

BarStyle defines valid styles for the progress bar

Functions

func GenerateBarChart

func GenerateBarChart(ctx context.Context, percent float64, size int, barType string) string

GenerateBarChart generates a bar chart with the given percent and size. Percent is a float64 from 0-100 representing the progress bar percentage Size is an int representing the length of the progress bar in characters BarType is a BarType representing the type of barchart: It can be one of the following:

SOLIDLT SOLIDMD SOLIDDK: Block characters with a dotted background
UNDERSCORE: Block characters with an line accross the boottom
EMPTY: Block characters with an empty background

Types

type Box

type Box struct {
	// contains filtered or unexported fields
}

Box contains a github and wakatime client and styling information for the gist box

func NewBox

func NewBox(wakaAPIKey, ghUsername, ghToken string, style BoxStyle) *Box

NewBox creates a box struct with appropriate wakatime and github information and gist styling information

func (*Box) ConstructLine

func (b *Box) ConstructLine(ctx context.Context, stat wakatime.StatItem) string

ConstructLine formats a gist line from stat infomation

func (*Box) GenerateGistLines

func (b *Box) GenerateGistLines(ctx context.Context, languages []wakatime.StatItem) ([]string, error)

GenerateGistLines takes an slice of wakatime.StatItems, and generates a line for the gist.

func (*Box) GetGist

func (b *Box) GetGist(ctx context.Context, id string) (*github.Gist, error)

GetGist gets the gist from github.com.

func (*Box) GetStats

func (b *Box) GetStats(ctx context.Context) ([]string, error)

GetStats gets the language stats form wakatime.com.

func (*Box) UpdateGist

func (b *Box) UpdateGist(ctx context.Context, id string, gist *github.Gist) error

UpdateGist updates the gist.

func (*Box) UpdateMarkdown

func (b *Box) UpdateMarkdown(ctx context.Context, title, filename string, content []byte) error

type BoxStyle

type BoxStyle struct {
	BarStyle  string // Style of the progress bar as defined by BarStyle
	BarLength string // Length of the bar as a string (gets converted to an Int)
	TimeStyle string // Style of the time text. "SHORT" will be abbreviated.
	// contains filtered or unexported fields
}

BoxStyle contains information for initalizing a gist box style

Jump to

Keyboard shortcuts

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