monotone-colorize.bashrc 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. ##
  2. ## monotone-colorize -- colorize output of mtn(1)
  3. ## Copyright (c) 2007 Ralf S. Engelschall <rse@engelschall.com>
  4. ##
  5. ## This program is free software; you can redistribute it and/or modify
  6. ## it under the terms of the GNU General Public License as published by
  7. ## the Free Software Foundation; either version 2 of the License, or
  8. ## (at your option) any later version.
  9. ##
  10. ## This program is distributed in the hope that it will be useful,
  11. ## but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. ## General Public License for more details.
  14. ##
  15. ## You should have received a copy of the GNU General Public License
  16. ## along with this program; if not, write to the Free Software
  17. ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  18. ## USA, or contact Ralf S. Engelschall <rse@engelschall.com>.
  19. ##
  20. ## monotone-colorize.bashrc: shell integration (language: GNU Bash)
  21. ##
  22. # wrap mtn(1) command for colorization via monotone-colorize(1)
  23. mtn () {
  24. case "$1" in
  25. u|up|upd|upda|updat|update )
  26. shift
  27. @l_prefix@/bin/mtn update ${1+"$@"} 2>&1 |\
  28. @l_prefix@/bin/monotone-colorize update
  29. ;;
  30. s|st|sta|stat|statu|status )
  31. shift
  32. @l_prefix@/bin/mtn status ${1+"$@"} |\
  33. @l_prefix@/bin/monotone-colorize status
  34. ;;
  35. l|lo|log )
  36. shift
  37. @l_prefix@/bin/mtn log ${1+"$@"} |\
  38. @l_prefix@/bin/monotone-colorize log
  39. ;;
  40. d|di|dif|diff )
  41. shift
  42. @l_prefix@/bin/mtn --quiet diff --no-show-header ${1+"$@"} |\
  43. @l_prefix@/bin/monotone-colorize diff
  44. ;;
  45. ls|l|li|lis|list )
  46. case "$2" in
  47. t|ta|tag|tags )
  48. shift; shift
  49. @l_prefix@/bin/mtn list tags ${1+"$@"} |\
  50. @l_prefix@/bin/monotone-colorize list-tags
  51. ;;
  52. b|br|bra|bran|branc|branch|branche|branches )
  53. shift; shift
  54. @l_prefix@/bin/mtn list branches ${1+"$@"} |\
  55. @l_prefix@/bin/monotone-colorize list-branches
  56. ;;
  57. * )
  58. @l_prefix@/bin/mtn ${1+"$@"}
  59. ;;
  60. esac
  61. ;;
  62. * )
  63. @l_prefix@/bin/mtn ${1+"$@"}
  64. ;;
  65. esac
  66. }