prompt

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

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

Go to latest
Published: Dec 17, 2020 License: MIT Imports: 3 Imported by: 0

README

prompt

colored prompts and messages for Go

Usage

Inside your module directory (with a go.mod file), run:

go get git.sr.ht/~iostream/prompt@master

The module will then be installed and added to go.mod. Replace master with a commit ID if you need a specific version. Don't forget to set GO111MODULE=on when working outside of GOPATH.

After installing, add the following line to your require block:

"git.sr.ht/~iostream/prompt"

More info TBA...

Documentation

Index

Constants

This section is empty.

Variables

View Source
var VerboseEnable = false

VerboseEnable controls output of Mverbose, Mverbose_e, DumpVar, and DumpSlice. If false, those functions yield nothing.

Functions

func DumpSlice

func DumpSlice(n string, v interface{})

DumpSlice prints slice length and content via Mverbose. WARNING: Will panic if passed argument is not a slice, or otherwise doesn't have Len().

func DumpVar

func DumpVar(n string, v interface{})

DumpVar prints variable content via Mverbose.

func Mbegin

func Mbegin()

Mbegin just prints a bright cyan word "begin!" if VerboseEnable is true. Used when debugging command line flags.

func Mcritical

func Mcritical(msg string)

Mcritical prints a message with a bright red [CRIT] tag.

func Mcritical_e

func Mcritical_e(err error)

Mcritical_e prints an error message with a bright red [CRIT] tag.

func Merror

func Merror(msg string)

Merror prints a message with a red [FAIL] tag.

func Merror_e

func Merror_e(err error)

Merror_e prints an error message with a red [FAIL] tag.

func Minfo

func Minfo(msg string)

Minfo prints a message with a cyan [INFO] tag.

func Mok

func Mok(msg string)

Mok prints a message with a green [ OK ] tag.

func Mprompt

func Mprompt(msg string)

Mprompt prints a message with a white [----] tag. Intended for use before Readline.

func Mverbose

func Mverbose(msg string)

Mverbose prints a message with a purple [VERB] tag, but only if VerboseEnable is true.

func Mverbose_e

func Mverbose_e(err error)

Mverbose_e prints an error message with a purple [VERB] tag, but only if VerboseEnable is true.

func Mwarning

func Mwarning(msg string)

Mwarning prints a message with a yellow [WARN] tag.

func Mwarning_e

func Mwarning_e(err error)

Mwarning_e prints an error message with a yellow [WARN] tag.

func ProcBegin

func ProcBegin(msg string)

ProcBegin prints a message on processing something without a newline. To indicate ending, use ProcEnd or ProcFail, or fmt.Printf("\r") for manual formatting.

func ProcEnd

func ProcEnd()

ProcEnd overwrites the label produced by ProcBegin, indicating success.

func ProcFail

func ProcFail()

ProcFail overwrites the label produced by ProcBegin, indicating failure. To provide error details, use fmt.Printf("\r"), then e.g. Merror("...").

func Readline

func Readline() string

Readline prints a white [>>>>] tag, then reads a string from stdin.

func TraceIn

func TraceIn(n string)

TraceIn is used to print the function name on entrance if VerboseEnable is true.

func TraceOut

func TraceOut(n string)

TraceOut is used to print the function name on exit if VerboseEnable is true. This should be deferred after TraceIn.

Types

This section is empty.

Jump to

Keyboard shortcuts

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