term

package module
v0.0.0-...-820ed05 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2017 License: ISC Imports: 7 Imported by: 0

README

goterminus

A simple package that provides a bunch of terminal output helpers.

Platform support

Goterminus has full support on 'Nix-like systems, but not quite complete support on Windows. On windows the cursor movement helpers aren't yet implemented as is EraseInLine().

Usage

Colour

There's a series of helpers for colourising strings, there's two variants for each colour:

term.Red("Hello World")
term.Redf("Hello %s", "World")
Output and formatting

Action(actionName string, msg string)

  • Info, Infof Outputs text in the default colour.
  • Action, Actionf Outputs a action name, and a msg. The name will be bright green and right aligned, the msg will be left aligned and the default colour.
  • Warn, Warnf Will display the word "WARNING" in yellow, and the msg in the default colour.
  • Error, Errorf WIll displays the word "ERROR" in red, and the msg in the default colour.
  • List Displays an array of items as a multi-column list, using the desired number of columns. The column width must be supplied.
  • Table Displays a set of data in a table, with an optional header.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Action

func Action(actionName string, msg string)

Action outputs a specific named action, and a accompying message

For example

Action("Created", "Resource `Legacy`")

func Actionf

func Actionf(actionName string, msg string, v ...interface{})

Actionf is identical to Action, except that the msg will be formated according to the format specifier

For example

Actionf("Created", "Resource `%s`", resourceName)

func Blue

func Blue(msg string) string

Blue returns a blue string

func Bluef

func Bluef(msg string, v ...interface{}) string

Bluef returns a blue string, except that the msg will be formated according to the format specifier

func Bold

func Bold(msg string) string

Bold returns a bold string

func BoldBlue

func BoldBlue(msg string) string

BoldBlue returns a BoldBlue string

func BoldBluef

func BoldBluef(msg string, v ...interface{}) string

BoldBluef returns a BoldBlue string, except that the msg will be formated according to the format specifier

func BoldCyan

func BoldCyan(msg string) string

BoldCyan returns a BoldCyan string

func BoldCyanf

func BoldCyanf(msg string, v ...interface{}) string

BoldCyanf returns a BoldCyan string, except that the msg will be formated according to the format specifier

func BoldGreen

func BoldGreen(msg string) string

BoldGreen returns a BoldGreen string

func BoldGreenf

func BoldGreenf(msg string, v ...interface{}) string

BoldGreenf returns a BoldGreen string, except that the msg will be formated according to the format specifier

func BoldRed

func BoldRed(msg string) string

BoldRed returns a BoldRed string

func BoldRedf

func BoldRedf(msg string, v ...interface{}) string

BoldRedf returns a BoldRed string, except that the msg will be formated according to the format specifier

func BoldYellow

func BoldYellow(msg string) string

BoldYellow returns a BoldYellow string

func BoldYellowf

func BoldYellowf(msg string, v ...interface{}) string

BoldYellowf returns a BoldYellow string, except that the msg will be formated according to the format specifier

func Boldf

func Boldf(msg string, v ...interface{}) string

Boldf returns a bold string, except that the msg will be formated according to the format specifier

func Clear

func Clear()

Clear clears all contents from the terminal window

func Colour

func Colour(code string, msg string) string

Colour returns a string

func Colourf

func Colourf(code string, msg string, v []interface{}) string

Colourf returns a string, except that the msg will be formated according to the format specifier

func CursorBackward

func CursorBackward(amount int)

CursorBackward moves the cursor backward the desired amount, relative to the current position

func CursorDown

func CursorDown(amount int)

CursorDown moves the cursor down the desired amount, relative to the current position

func CursorForward

func CursorForward(amount int)

CursorForward moves the cursor forward the desired amount, relative to the current position

func CursorUp

func CursorUp(amount int)

CursorUp moves the cursor up the desired amount, relative to the current position

func Cyan

func Cyan(msg string) string

Cyan returns a Cyan string

func Cyanf

func Cyanf(msg string, v ...interface{}) string

Cyanf returns a Cyan string, except that the msg will be formated according to the format specifier

func Dim

func Dim(msg string) string

Dim returns a dim string

func DimBlue

func DimBlue(msg string) string

DimBlue returns a DimBlue string

func DimBluef

func DimBluef(msg string, v ...interface{}) string

DimBluef returns a DimBlue string, except that the msg will be formated according to the format specifier

func DimCyan

func DimCyan(msg string) string

DimCyan returns a DimCyan string

func DimCyanf

func DimCyanf(msg string, v ...interface{}) string

DimCyanf returns a DimCyan string, except that the msg will be formated according to the format specifier

func DimGreen

func DimGreen(msg string) string

DimGreen returns a DimGreen string

func DimGreenf

func DimGreenf(msg string, v ...interface{}) string

DimGreenf returns a DimGreen string, except that the msg will be formated according to the format specifier

func DimRed

func DimRed(msg string) string

DimRed returns a DimRed string

func DimRedf

func DimRedf(msg string, v ...interface{}) string

DimRedf returns a DimRed string, except that the msg will be formated according to the format specifier

func DimYellow

func DimYellow(msg string) string

DimYellow returns a DimYellow string

func DimYellowf

func DimYellowf(msg string, v ...interface{}) string

DimYellowf returns a DimYellow string, except that the msg will be formated according to the format specifier

func Dimf

func Dimf(msg string, v ...interface{}) string

Dimf returns a dim string, except that the msg will be formated according to the format specifier

func EraseInLine

func EraseInLine()

EraseInLine ...

func Error

func Error(msg string)

Error outputs the message, highlighted to indicate that it's an error

For example

Error("Resource `Legacy` was invalid")

func Errorf

func Errorf(msg string, v ...interface{})

Errorf is identical to Error, except that the msg will be formated according to the format specifier

For example

Errorf("Resource `%s` was invalid: %v", resourceName, err)

func Green

func Green(msg string) string

Green returns a Green string

func Greenf

func Greenf(msg string, v ...interface{}) string

Greenf returns a Green string, except that the msg will be formated according to the format specifier

func HighlightSource

func HighlightSource(source string) string

HighlightSource returns a string colour to indicate that the contents represents source code.

func HighlightSourcef

func HighlightSourcef(source string, v ...interface{}) string

HighlightSourcef returns a string colour to indicate that the contents represents source code.

func Info

func Info(msg string)

Info outputs generate info.

func Infof

func Infof(msg string, v ...interface{})

Infof is identical to Info, except that the msg will be formated according to the format specifier

func List

func List(items []string, numColumns int, columnWidth int)

List renders a list of strings in one or more columns

func Red

func Red(msg string) string

Red returns a Red string

func Redf

func Redf(msg string, v ...interface{}) string

Redf returns a Red string, except that the msg will be formated according to the format specifier

func Table

func Table(headers []string, rows ...[]string)

func Warn

func Warn(msg string)

Warn outputs the message, highlighted to indicate that it's a warning

For example

Warn("Resource `Legacy` already existed, ignored")

func Warnf

func Warnf(msg string, v ...interface{})

Warnf is identical to Warn, except that the msg will be formated according to the format specifier

For example

Warnf("Resource `%s` already existed, ignored", resourceName)

func Yellow

func Yellow(msg string) string

Yellow returns a Yellow string

func Yellowf

func Yellowf(msg string, v ...interface{}) string

Yellowf returns a Yellow string, except that the msg will be formated according to the format specifier

Types

This section is empty.

Jump to

Keyboard shortcuts

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