Skip to content

Framework for handling errors gracefully, colorize text and parse options in a readable manner.

License

Notifications You must be signed in to change notification settings

tldr-pages/tldr-bash-framework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

tldr-bash-framework

Framework for handling errors gracefully, colorize text and parse options in a readable manner.

No dependencies exist for this script: it's self-contained.

Functions

Coloring

All color functions accept the following color values: none, black, red, green, yellow, blue, magenta, cyan, light-gray, gray, light-red, light-green, light-yellow, light-blue, light-magenta, light-cyan, white.

  • raw_foreground {{color_name}} - obtain ANSI color sequence for a specific foreground color
  • raw_background {{color_name}} - obtain ANSI color sequence for a specific background color
  • foreground {{color_name}} - obtain interpreted ANSI color sequence for a specific foreground color
  • background {{color_name}} - obtain interpreted ANSI color sequence for a specific background color

Error reporting

All error reporting functions without user_ prefix must not be used to display messages for user - they are for developers. main is shown instead of function name when internal error reporting function was called outside another function.

  • info {{description}} - display internal info note in the following format: {{function_caused_this_message_to_appear|main}}: info: {{description}}

  • warn {{description}} - display internal warning note in the following format: {{function_caused_this_message_to_appear|main}}: warn: {{description}}

  • error {{description}} - display internal error note in the following format: {{function_caused_this_message_to_appear|main}}: error: {{description}}

  • user_info {{description}} - display user info note in the following format: info: {{description}}

  • user_warn {{description}} - display user warning note in the following format: warn: {{description}}

  • user_error {{description}} - display user error note in the following format: error: {{description}}

Keywords coloring

It's possible to change info, warn and error colors via the following environment variables: INFO_FOREGROUND_COLOR, WARN_FOREGROUND_COLOR, ERROR_FOREGROUND_COLOR, INFO_BACKGROUND_COLOR, WARN_BACKGROUND_COLOR, ERROR_BACKGROUND_COLOR.

About

Framework for handling errors gracefully, colorize text and parse options in a readable manner.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published

Languages