Renders just about anything as human-friendly as possible.
Primary use case is as a output formatter for CLIs tools.
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)
Render functions should write a new-line at the end of the output.
type MyType struct {
// ...
}
func (t *MyType) RenderHuman(io.Writer) error {
// ...
}
renderer := human.NewRenderer(os.Stdout)
RegisterTypeRenderer(renderer, func (io.Writer, b bool) error {
// ...
})
var b bool
err := renderer.Render(b)