Skip to content
/ human Public

Renders just about anything as human-friendly as possible.

Notifications You must be signed in to change notification settings

tipee-sa/human

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Human

Renders just about anything as human-friendly as possible.

Primary use case is as a output formatter for CLIs tools.

Usage

var value any
str, err := human.Render(value)
var value any
err := human.Write(os.Stdout, value)
var value any
err := human.NewRenderer(os.Stdout).Render(value)

Custom rendering

Render functions should write a new-line at the end of the output.

Using the human.RenderHuman interface

type MyType struct {
    // ...
}

func (t *MyType) RenderHuman(io.Writer) error {
    // ...
}

Registering a type renderer

renderer := human.NewRenderer(os.Stdout)

RegisterTypeRenderer(renderer, func (io.Writer, b bool) error {
    // ...
})

var b bool
err := renderer.Render(b)

About

Renders just about anything as human-friendly as possible.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages