Skip to content

An easy to use golang package for stylizing terminal output

License

Notifications You must be signed in to change notification settings

dollarshaveclub/line

Repository files navigation

line  

GoDoc CircleCI Go Report Card

line is an easy to use package for stylizing terminal output. line focuses on usability via chaining and, consequently, is quite flexible. line also boasts compatibility with the popular Color package.

Install

go get github.com/dollarshaveclub/line

Usage

Simple

package main

import "github.com/dollarshaveclub/line"

func main() {
    line.Red().Print("Hello ").Green("World").Blue().Println("!!!")
}

Simple Usage

Prefix / Suffix

package main

import "github.com/dollarshaveclub/line"

func main() {
	line.Prefix("--> ").Suffix(" <---").Println("Nice to meet you!").Println("And you too!")
}

Prefix / Suffix Usage

Complex

package main

import (
	"os"

	"github.com/dollarshaveclub/line"
	"github.com/fatih/color"
)

func main() {
	output := line.New(os.Stdout, "", "", line.WhiteColor)
	output.Println("Welcome! Here is a list:")

	li := output.Prefix("--> ").Red()
	li.Println("one").Println("two").Println("sub")

	subli := li.Prefix("  --> ").Green()
	subli.Println("a").Println("b")

	output.Println()

	boldgreen := color.New(color.Bold, color.FgMagenta)
	output.Format(boldgreen).Println("Have a nice day!")
}

Complex Usage

Releases

No releases published

Packages

 
 
 

Languages