Skip to content
generated from gleich/go_template

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

License

Notifications You must be signed in to change notification settings

gleich/statuser

Repository files navigation

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