Mercurial > hg > config
diff python/quotemail.py @ 365:6bbc4867a795
begin porting from shell function
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Thu, 11 Jul 2013 17:01:42 -0700 |
parents | |
children | c78da6f7ca79 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/python/quotemail.py Thu Jul 11 17:01:42 2013 -0700 @@ -0,0 +1,13 @@ +#!/usr/bin/env python + +""" +quote as per email +""" + +def prefix(text, quote='> '): + return '\n'.join(['%s%s' % (quote, line.rstrip()) + for line in text.strip().splitlines()]) + +if __name__ == '__main__': + import sys + print prefix(sys.stdin.read())