changeset 4:26bb5e99f76c

textshaper/main.py
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 24 Sep 2013 16:43:06 -0700
parents 925a7959cd0b
children 0a800613af9a
files textshaper/main.py
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/textshaper/main.py	Mon Sep 23 00:04:00 2013 -0700
+++ b/textshaper/main.py	Tue Sep 24 16:43:06 2013 -0700
@@ -2,7 +2,7 @@
 # -*- coding: utf-8 -*-
 
 """
-package to shape text blocks 
+package to shape text blocks
 """
 
 import optparse
@@ -11,6 +11,12 @@
 import sys
 import time
 
+def display(content)
+    print content
+    print '--'
+    nlines = len(content.splitlines())
+    print '%d lines' % nlines
+
 def add_options(parser):
     """add options to the OptionParser instance"""
 
@@ -32,7 +38,7 @@
     content = sys.stdin.read()
 
     # print formatted content
-    print content
+    display(content)
 
     while True:
         time.sleep(1) # XXX