statuser

package module
v2.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2021 License: MIT Imports: 6 Imported by: 10

README ΒΆ

statuser GitHub release (latest by date including pre-releases)

πŸ“£ A user-friendly status outputting library for go

build lint test

πŸš€ Installing

Simply run the command below in the root of your go project:

go get -u github.com/gleich/statuser/v2

πŸ“š Documentation GoDoc

Here is some basic usage:

Error()

Output an error to the user

Parameters
  1. message
    • Type: string
    • Description: A human readable message to help the user
  2. err
    • Type: err
    • Description: The golang error
  3. exitCode
    • Type: int
    • Description: Exit code used to exit the program
Example

Outputs the following in red text:

β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘
β–‘πŸš¨ ERROR πŸš¨β–‘
β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘

message

GOLANG ERROR (SHOW DEVELOPER):
err
exit status 1
ErrorMsg()

Output an error to the user with just a message

Parameters
  1. message
    • Type: string
    • Description: A human readable message to help the user
  2. exitCode
    • Type: int
    • Description: Exit code used to exit the program
Example

Outputs the following in red text:

β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘
β–‘πŸš¨ ERROR πŸš¨β–‘
β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘

message
exit status 1
Warning()

Output a warning the user

Parameters
  1. message
    • Type: string
    • Description: The warning message to display to the user
Example

Outputs the following text in yellow:

⚠️ WARNING ⚠️
message
Success()

Output a warning the user

Parameters
  1. message
    • Type: string
    • Description: The success message to display to the user
Example

Outputs the following text in green:

βœ… message

Contributors

  1. Matthew Gleich (@gleich)

πŸ‘₯ Contributors

Documentation ΒΆ

Index ΒΆ

Constants ΒΆ

This section is empty.

Variables ΒΆ

View Source
var (
	// If the output should use emojis
	Emojis = true

	// Error emoji
	ErrorEmoji = emoji.PoliceCarLight
	// Error text
	ErrorText = " ERROR "
	// Error box character
	ErrorBoxChar = "β–‘"
	// Error character if emojis are turned off
	ErrorChar = "βœ—"

	// Warning emoji
	WarningEmoji = emoji.Warning
	// Warning text
	WarningText = " WARNING "
	// Warning character if emojis are turned off
	WarningChar = "β—ˆ"

	// Success emoji
	SuccessEmoji = emoji.CheckMarkButton
	// Warning text
	SuccessText = " "
	// Warning character if emojis are turned off
	SuccessChar = "βœ”"
)

Functions ΒΆ

func Error ΒΆ

func Error(message string, err error, exitCode int)

Output an error to the user

func ErrorMsg ΒΆ

func ErrorMsg(message string, exitCode int)

Output an error to the user

func Success ΒΆ

func Success(msgItems ...interface{})

Output a success to the user

func Warning ΒΆ

func Warning(msgItems ...interface{})

Output a warning to the user

Types ΒΆ

This section is empty.

Jump to

Keyboard shortcuts

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