stylish

package module
v0.0.0-...-f301905 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2019 License: MIT Imports: 3 Imported by: 39

README

Nanobox Stylish

A stylish little library that styles output according to the nanobox style guide (http://nanodocs.gopagoda.io/engines/style-guide/)

Installation

Frist go get the project...

go get github.com/nanobox-io/nanobox-golang-stylish

...then include the library in your project

include github.com/nanobox-io/nanobox-golang-stylish

Usage

Available styles:

  • ProcessStart(process string)
  • ProcessEnd(process string)
  • Bullet(bullet string/[]string{"bullet", "bullet"...})
  • Warning(body string)
  • Fatal(header, body string)

For detailed information see the complete documentation

Examples

Processes
stylish.ProcessStart("i am a process")
// process output
stylish.ProcessEnd()

// outputs
+ I am a process ------------------------------------------------------------ >
// process output
Bullets
single bullet
stylish.Bullet("i am a bullet")

// outputs
+ i am a bullet
multiple bullets
stylish.Bullet([]string{"we", "are", "many", "bullets"})

// outputs
+ we
+ are
+ many
+ bullets
Warnings
stylish.Warning("i am a warning")

// outputs
----------------------------------  WARNING  ----------------------------------
i am a warning
Errors
stylish.Error("i am an error", "things are probably going to explode now")

// outputs
:::::::::::::::::::::: I AM AN ERROR!!!

things are probably going to explode now

:::::::::::::::::::::::::::::::::::::::

Documentation

Complete documentation is available on godoc.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bullet

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

Bullet styles and prints a message as outlined at: http://nanodocs.gopagoda.io/engines/style-guide#bullet-points

Usage: Bullet "i am a bullet"

Output: + i am a bullet

func Error

func Error(heading, body string) string

Error styles and prints a message as outlined at: http://nanodocs.gopagoda.io/engines/style-guide#fatal_errors

Usage: Error "nuclear launch detected", "All your base are belong to us"

Output: ::::::::::::: NUCLEAR LAUNCH DETECTED!!!

All your base are belong to us

::::::::::::::::::::::::::::::::::::::::

func ErrorBody

func ErrorBody(body string, v ...interface{}) string

ErrorBody styles and prints an error body as outlined at: http://nanodocs.gopagoda.io/engines/style-guide#fatal_errors

Usage: ErrorBody "All your base are belong to us"

Output: All your base are belong to us

func ErrorFoot

func ErrorFoot() string

ErrorFoot styles and prints an error body as outlined at: http://nanodocs.gopagoda.io/engines/style-guide#fatal_errors

Usage: ErrorFoot())

Output: ::::::::::::::::::::::::::::::::::::::::

func ErrorHead

func ErrorHead(heading string, v ...interface{}) string

ErrorHead styles and prints an error heading as outlined at: http://nanodocs.gopagoda.io/engines/style-guide#fatal_errors

Usage: ErrorHead "nuclear launch detected"

Output: ::::::::::::: NUCLEAR LAUNCH DETECTED!!!

func GenerateNestedPrefix

func GenerateNestedPrefix(level int) string

GenerateNestedPrefix will generate a prefix string of spaces to match the specified depth level

func Marker

func Marker(mark, msg string, v ...interface{}) string

Marker is the root for Bullet/SubBullet; used alone, it allows for a custom mark to be specified

Usage: Maker "*", "i am a marker"

Output: * i am a marker

func Nest

func Nest(level int, msg string) (rtn string)

Nest is a generic nesting function that will generate the appropariate prefix based on the nest level

func ProcessEnd

func ProcessEnd() string

ProcessEnd styles and prints a 'child process' as outlined at: http://nanodocs.gopagoda.io/engines/style-guide#child-process

Usage: ProcessEnd

Output: <new line>

func ProcessStart

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

ProcessStart styles and prints a 'child process' as outlined at: http://nanodocs.gopagoda.io/engines/style-guide#child-process

Usage: ProcessStart "i am a process"

Output: + I am a process ------------------------------------------------------------ >

func SubBullet

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

SubBullet styles and prints a message as outlined at: http://nanodocs.gopagoda.io/engines/style-guide#bullet-points

Usage: SubBullet "i am a sub bullet"

Output:

i am a sub bullet

func Warning

func Warning(body string, v ...interface{}) string

Warning styles and prints a message as outlined at: http://nanodocs.gopagoda.io/engines/style-guide#warning

Usage: Warning "You just bought Hot Pockets!"

Output: ----------------------------- WARNING ----------------------------- You just bought Hot Pockets!

Types

This section is empty.

Jump to

Keyboard shortcuts

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