Skip to content

Commit

Permalink
Display current rules and comments when no flag is specified
Browse files Browse the repository at this point in the history
  • Loading branch information
apinsard committed Oct 5, 2014
1 parent af3b4b9 commit 618ad46
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion chuse
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ DATETIME_FORMAT = "[%Y-%m-%dT%H:%M]"
COLORS = True

def _colorize(text, color_code, bold=False):
if not COLORS:
return text

start = "\033["
if bold:
start += "1;"
Expand Down Expand Up @@ -289,5 +292,13 @@ if __name__ == '__main__':
except PermissionError:
error("You are not root!")
else:
output("Current flags: %s" % ' '.join(''.join(f) for f in cur_flags))
try:
with open(PACKAGE_USE_FILE_PATTERN % atom) as f:
for line in f.readlines():
line = line[:-1]
if line != '' and line[0] == '#':
line = _purple(line);
output(line)
except FileNotFoundError:
output("No flag currently defined for %s" % atom['raw'])

0 comments on commit 618ad46

Please sign in to comment.