Skip to content

Commit

Permalink
checkkconfigsymbols.py: colored output
Browse files Browse the repository at this point in the history
Color output to make it more readable.  Symbols will be printed yellow,
relevant commits (see --find) red.

Signed-off-by: Valentin Rothberg <[email protected]>
Acked-by: Stefan Hengelein <[email protected]>
Acked-by: Andreas Ruprecht <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
vrothberg authored and gregkh committed Aug 4, 2015
1 parent a42fa92 commit c745566
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions scripts/checkkconfigsymbols.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

"""Find Kconfig symbols that are referenced but not defined."""

# (c) 2014-2015 Valentin Rothberg <[email protected]>
# (c) 2014-2015 Valentin Rothberg <[email protected]>
# (c) 2014 Stefan Hengelein <[email protected]>
#
# Licensed under the terms of the GNU GPL License version 2
Expand Down Expand Up @@ -136,19 +136,19 @@ def main():
# feature has not been undefined before
if not feature in undefined_a:
files = sorted(undefined_b.get(feature))
print "%s\t%s" % (feature, ", ".join(files))
print "%s\t%s" % (yel(feature), ", ".join(files))
if opts.find:
commits = find_commits(feature, opts.diff)
print commits
print red(commits)
# check if there are new files that reference the undefined feature
else:
files = sorted(undefined_b.get(feature) -
undefined_a.get(feature))
if files:
print "%s\t%s" % (feature, ", ".join(files))
print "%s\t%s" % (yel(feature), ", ".join(files))
if opts.find:
commits = find_commits(feature, opts.diff)
print commits
print red(commits)

# reset to head
execute("git reset --hard %s" % head)
Expand All @@ -158,7 +158,21 @@ def main():
undefined = check_symbols(opts.ignore)
for feature in sorted(undefined):
files = sorted(undefined.get(feature))
print "%s\t%s" % (feature, ", ".join(files))
print "%s\t%s" % (yel(feature), ", ".join(files))


def yel(string):
"""
Color %string yellow.
"""
return "\033[33m%s\033[0m" % string


def red(string):
"""
Color %string red.
"""
return "\033[31m%s\033[0m" % string


def execute(cmd):
Expand Down

0 comments on commit c745566

Please sign in to comment.