Categorygithub.com/heaths/go-console
repositorypackage
0.8.0
Repository: https://github.com/heaths/go-console.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author

# README

Go Console APIs

releases reference ci

These Go Console APIs provide a level of abstraction over virtual terminals, implement testable io.Writer, and support color schemes.

Example

You can create a new console using os streams:

package main

import (
    "fmt"

    "github.com/heaths/go-console"
)

func main() {
    con := console.System()
    fmt.Fprintln(con.Stdout(), "Hello, world!")
}

Fake

You can also create a new fake console that uses bytes.Buffer you can access from Stdout() as well:

package main

import (
    "fmt"

    "github.com/heaths/go-console"
)

func main() {
    fake := console.Fake()
    fmt.Fprintln(fake.Stdout(), "Hello, fake!")
    fmt.Println(fake.Stdout().String())
}

License

This project is licensed under the MIT license.