tools: Add color to git blame output.

This commit is contained in:
Andrew Hamilton 2019-07-17 22:17:12 +10:00
parent e8d9c301c0
commit 81e19a2062
2 changed files with 12 additions and 7 deletions

View file

@ -399,6 +399,18 @@ def perltidy(path):
return Status.normal, _syntax_highlight_using_path(stdout, path)
@deps(deps={"git"}, url="https://git-scm.com/docs/git-blame",
executables={"git"})
def git_blame(path):
process = subprocess.run([
"git", "blame", "--show-stats", "--date=short", "--color-lines",
"--color-by-age", path], text=True, capture_output=True)
status = (Status.normal if process.returncode == 0
else Status.not_applicable)
return status, fill3.Fixed(termstr.TermStr.from_term(
process.stdout + process.stderr). splitlines())
@deps(deps={"git"}, url="https://git-scm.com/docs/git-log",
executables={"git"})
def git_log(path):

View file

@ -88,13 +88,6 @@ tools_for_extensions = [
command = "python3.7 -m dis"
success_status = "normal"
[git_blame]
dependencies = ["git"]
url = "https://git-scm.com/docs/git-blame"
command = "git blame --show-stats --date=short"
success_status = "normal"
error_status = "not_applicable"
[objdump_headers]
dependencies = ["binutils"]
url = "https://en.wikipedia.org/wiki/Objdump"