A console script that allows you to easily update multiple git repositories at once
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 line
794 B

  1. # -*- coding: utf-8 -*-
  2. #
  3. # Copyright (C) 2011-2014 Ben Kurtovic <ben.kurtovic@gmail.com>
  4. # See the LICENSE file for details.
  5. import re
  6. __all__ = ["out", "bold", "red", "green", "yellow", "blue"]
  7. # Text formatting functions:
  8. bold = lambda t: "\x1b[1m" + t + "\x1b[0m"
  9. red = lambda t: "\x1b[1m\x1b[31m" + t + "\x1b[0m"
  10. green = lambda t: "\x1b[1m\x1b[32m" + t + "\x1b[0m"
  11. yellow = lambda t: "\x1b[1m\x1b[33m" + t + "\x1b[0m"
  12. blue = lambda t: "\x1b[1m\x1b[34m" + t + "\x1b[0m"
  13. def out(indent, msg):
  14. """Print a message at a given indentation level."""
  15. width = 4 # Amount to indent at each level
  16. if indent == 0:
  17. spacing = "\n"
  18. else:
  19. spacing = " " * width * indent
  20. msg = re.sub(r"\s+", " ", msg) # Collapse multiple spaces into one
  21. print(spacing + msg)