From beac864d29a4b883e73c6e0bb0eae7a98886924a Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Sun, 2 Mar 2014 00:53:34 -0500 Subject: [PATCH] Clean up output.py. --- gitup/output.py | 26 +++++--------------------- gitup/update.py | 2 +- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/gitup/output.py b/gitup/output.py index a92d86c..7b160ea 100644 --- a/gitup/output.py +++ b/gitup/output.py @@ -8,27 +8,11 @@ import re __all__ = ["out", "bold", "red", "green", "yellow", "blue"] # Text formatting functions: -bold = lambda t: _style_text(t, "bold") -red = lambda t: _style_text(t, "red") -green = lambda t: _style_text(t, "green") -yellow = lambda t: _style_text(t, "yellow") -blue = lambda t: _style_text(t, "blue") - -def _style_text(text, effect): - """Give a text string a certain effect, such as boldness, or a color.""" - ansi = { # ANSI escape codes to make terminal output fancy - "reset": "\x1b[0m", - "bold": "\x1b[1m", - "red": "\x1b[1m\x1b[31m", - "green": "\x1b[1m\x1b[32m", - "yellow": "\x1b[1m\x1b[33m", - "blue": "\x1b[1m\x1b[34m", - } - - try: # Pad text with effect, unless effect does not exist - return ansi[effect] + text + ansi["reset"] - except KeyError: - return text +bold = lambda t: "\x1b[1m" + t + "\x1b[0m" +red = lambda t: "\x1b[1m\x1b[31m" + t + "\x1b[0m" +green = lambda t: "\x1b[1m\x1b[32m" + t + "\x1b[0m" +yellow = lambda t: "\x1b[1m\x1b[33m" + t + "\x1b[0m" +blue = lambda t: "\x1b[1m\x1b[34m" + t + "\x1b[0m" def out(indent, msg): """Print a message at a given indentation level.""" diff --git a/gitup/update.py b/gitup/update.py index 0245159..480a2e9 100644 --- a/gitup/update.py +++ b/gitup/update.py @@ -107,7 +107,7 @@ def _update_directory(dir_path, dir_name, is_bookmark=False): for item in dir_contents: repo_path = os.path.join(dir_path, item) repo_name = os.path.join(dir_name, item) - if _directory_is_git_repo(repo_path): # Filter out non-repositories + if _directory_is_git_repo(repo_path): # Filter out non-repos repositories.append((repo_path, repo_name)) num_of_repos = len(repositories)