comparison textshaper/main.py @ 4:26bb5e99f76c

textshaper/main.py
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 24 Sep 2013 16:43:06 -0700
parents 925a7959cd0b
children 0a800613af9a
comparison
equal deleted inserted replaced
3:925a7959cd0b 4:26bb5e99f76c
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*- 2 # -*- coding: utf-8 -*-
3 3
4 """ 4 """
5 package to shape text blocks 5 package to shape text blocks
6 """ 6 """
7 7
8 import optparse 8 import optparse
9 import os 9 import os
10 import subprocess 10 import subprocess
11 import sys 11 import sys
12 import time 12 import time
13
14 def display(content)
15 print content
16 print '--'
17 nlines = len(content.splitlines())
18 print '%d lines' % nlines
13 19
14 def add_options(parser): 20 def add_options(parser):
15 """add options to the OptionParser instance""" 21 """add options to the OptionParser instance"""
16 22
17 def main(args=sys.argv[1:]): 23 def main(args=sys.argv[1:]):
30 36
31 # read from stdin 37 # read from stdin
32 content = sys.stdin.read() 38 content = sys.stdin.read()
33 39
34 # print formatted content 40 # print formatted content
35 print content 41 display(content)
36 42
37 while True: 43 while True:
38 time.sleep(1) # XXX 44 time.sleep(1) # XXX
39 45
40 if __name__ == '__main__': 46 if __name__ == '__main__':