Files
clint/examples/piped.py
T
2011-03-24 05:06:23 -04:00

26 lines
571 B
Python

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
from __future__ import with_statement
sys.path.insert(0, os.path.abspath('..'))
from clint import piped_in
from clint.textui import colored, indent, puts
if __name__ == '__main__':
in_data = piped_in()
with indent(4, quote='>>>'):
if in_data:
puts('Data was piped in! Here it is:')
with indent(5, quote=colored.red(' |')):
puts(in_data)
else:
puts(colored.red('Warning: ') + 'No data was piped in.')