formatting

package
v0.0.0-...-83d7e21 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Plain    Style = "plain"
	Markdown       = "markdown"
	Json           = "json"
	Csv            = "csv"
)

Variables

This section is empty.

Functions

func GetRelativeTime

func GetRelativeTime(clock Clock, timestamp time.Time) string

Converts a timestamp from the past to a high-level human-readable time string (e.g. "2 minutes ago", "5 years ago", etc).

func WriteCsv

func WriteCsv(items []api.Item, w io.Writer)

func WriteJson

func WriteJson(items []api.Item, w io.Writer)

func WriteMarkdown

func WriteMarkdown(items []api.Item, clock Clock, w io.Writer)

func WritePlain

func WritePlain(items []api.Item, clock Clock, w io.Writer)

Types

type Clock

type Clock interface {
	Now() time.Time
}

type RealClock

type RealClock struct{}

func (*RealClock) Now

func (c *RealClock) Now() time.Time

type Style

type Style string

Jump to

Keyboard shortcuts

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