Skip to content

Commit

Permalink
newline changes
Browse files Browse the repository at this point in the history
  • Loading branch information
twaugh committed Oct 8, 2015
1 parent 10db521 commit f7402d0
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions journal_brief/cli/main.py
Expand Up @@ -100,18 +100,14 @@ def show_stats(self, entries, exclusions):
for stat in stats:
print(strf.format(FREQ=stat.hits, EXCLUSION=repr(stat.exclusion)))

def format_output(self, formatters, jfilter):
def format_output(self, stream, formatters, jfilter):
for entry in jfilter:
for formatter in formatters:
output = formatter.format(entry)
if output:
print(output)
stream.write(formatter.format(entry))

def flush_output(self, formatters):
def flush_output(self, stream, formatters):
for formatter in formatters:
output = formatter.flush()
if output:
print(output)
stream.write(formatter.flush())

def run(self):
if self.config.get('debug'):
Expand Down Expand Up @@ -157,9 +153,9 @@ def run(self):
formatters = [get_formatter(format) for format in formats]

try:
self.format_output(formatters, jfilter)
self.format_output(sys.stdout, formatters, jfilter)
finally:
self.flush_output(formatters)
self.flush_output(sys.stdout, formatters)


def run():
Expand Down

0 comments on commit f7402d0

Please sign in to comment.