A console script that allows you to easily update multiple git repositories at once
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

26 linhas
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)