Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. #! /usr/bin/env bash
  2.  
  3. #/
  4. #|-------------------------------------------------------------------------------
  5. #| Util Lib for Bash
  6. #|-------------------------------------------------------------------------------
  7. #|
  8. #| Includes:
  9. #| - Shell color escapes
  10. #| - Function to print pretty errors for missing bin's
  11. #|
  12. #/
  13.  
  14. reset='\e[0m'
  15. bold='\e[1m'
  16. dim='\e[2m'
  17. underlined='\e[4m'
  18. blink='\e[5m'
  19. inverted='\e[7m'
  20. hidden='\e[8m'
  21.  
  22. default='\e[39m'
  23. black='\e[30m'
  24. white='\e[97m'
  25. red='\e[31m'
  26. green='\e[32m'
  27. yellow='\e[33m'
  28. blue='\e[34m'
  29. magenta='\e[35m'
  30. cyan='\e[36m'
  31. lightGray='\e[37m'
  32. darkGray='\e[90m'
  33. lightRed='\e[91m'
  34. lightGreen='\e[92m'
  35. lightYellow='\e[93m'
  36. lightBlue='\e[94m'
  37. lightMagenta='\e[95m'
  38. lightCyan='\e[96m'
  39.  
  40. bgDefault='\e[49m'
  41. bgBlack='\e[40m'
  42. bgWhite='\e[107m'
  43. bgRed='\e[41m'
  44. bgGreen='\e[42m'
  45. bgYellow='\e[43m'
  46. bgBlue='\e[44m'
  47. bgMagenta='\e[45m'
  48. bgCyan='\e[46m'
  49. bgLightGray='\e[47m'
  50. bgDarkGray='\e[100m'
  51. bgLightRed='\e[101m'
  52. bgLightGreen='\e[102m'
  53. bgLightYellow='\e[103m'
  54. bgLightBlue='\e[104m'
  55. bgLightMagenta='\e[105m'
  56. bgLightCyan='\e[106m'
  57.  
  58. lib_cli_exists () {
  59. _path=${2:-"$PATH"}
  60. if ! PATH="$_path" which "$1" &> /dev/null; then
  61. >&2 printf " ${bgRed}${white}${bold} Error: Could not find '$1' cli on PATH. ${reset}"
  62. >&2 echo
  63. PATH="$_path" which "$1" &> /dev/null
  64. fi
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement