# HG changeset patch # User Jeff Hammel # Date 1393181950 28800 # Node ID a43d0ad17c295b1414a6b8c25f3acd1d263f5952 # Parent 0930c6884f8a878834c9f2fd74ad23beff0367dc STUB: textshaper/quote.py textshaper/split.py diff -r 0930c6884f8a -r a43d0ad17c29 textshaper/quote.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/textshaper/quote.py Sun Feb 23 10:59:10 2014 -0800 @@ -0,0 +1,31 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +split some lines +""" + +import argparse +import os +import sys + +def main(args=sys.argv[1:]): + + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('input', nargs='?', + type=argparse.FileType('r'), default=sys.stdin, + help='input file, or read from stdin if ommitted') + parser.add_argument('--quote', dest='quote', + action='store_true', default=False) + options = parser.parse_args(args) + + read = options.input.read() + + lines = read.strip().split() + if options.quote: + lines = ["'{}'".format(line) for line in lines] + + print '\n'.join(lines) + +if __name__ == '__main__': + main() diff -r 0930c6884f8a -r a43d0ad17c29 textshaper/split.py --- a/textshaper/split.py Sun Feb 23 10:57:19 2014 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -""" -split some lines -""" - -import argparse -import os -import sys - -def main(args=sys.argv[1:]): - - parser = argparse.ArgumentParser(description=__doc__) - parser.add_argument('input', nargs='?', - type=argparse.FileType('r'), default=sys.stdin, - help='input file, or read from stdin if ommitted') - parser.add_argument('--quote', dest='quote', - action='store_true', default=False) - options = parser.parse_args(args) - - read = options.input.read() - - lines = read.strip().split() - if options.quote: - lines = ["'{}'".format(line) for line in lines] - - print '\n'.join(lines) - -if __name__ == '__main__': - main()