diff options
author | kxxoling <kxxoling@gmail.com> | 2015-05-01 23:15:31 +0800 |
---|---|---|
committer | kxxoling <kxxoling@gmail.com> | 2015-05-01 23:15:31 +0800 |
commit | 35f5928f72e7389fce24f5143981dae6daffcf95 (patch) | |
tree | bbef2b8ca6bf289a7747faac6ec9f0e340a6c2d2 | |
parent | 557a0494101ad8fad8f8ac1ed60a20cb1042b7c0 (diff) | |
parent | 38be2143c9e47880f730da7e4c4d4bb8b7804362 (diff) | |
download | python-prettytable-ptable-35f5928f72e7389fce24f5143981dae6daffcf95.tar.gz |
Merge branch 'feature/cli-support' into develop
-rw-r--r-- | CHANGELOG | 4 | ||||
-rw-r--r-- | prettytable/cli.py | 16 | ||||
-rw-r--r-- | setup.py | 15 |
3 files changed, 33 insertions, 2 deletions
@@ -1,3 +1,7 @@ +########## PrettyTable 0.9 - May 1, 2015 ########### + +* Add command line tool ``ptable``. Usage: ``ptable --csv=filename``. + ########## PrettyTable 0.8 - Oct XX, 2013 ########### * New "paginate" method can be used to produce strings suitable diff --git a/prettytable/cli.py b/prettytable/cli.py index e69de29..95b5a90 100644 --- a/prettytable/cli.py +++ b/prettytable/cli.py @@ -0,0 +1,16 @@ +from __future__ import print_function +import argparse +from .factory import from_csv + + +def main(): + parser = argparse.ArgumentParser(description='A simple Python library designed to make it quick and easy to ' + 'represent tabular data in visually appealing ASCII tables.') + parser.add_argument('--csv', help='CSV file name') + args = parser.parse_args() + with open(args.csv) as fp: + print(from_csv(fp)) + + +if __name__ == '__main__': + main() @@ -2,9 +2,17 @@ from setuptools import setup from prettytable import __version__ as version + setup( name='prettytable', version=version, + include_package_data=True, + zip_safe=False, + entry_points={ + 'console_scripts': [ + 'ptable = prettytable.cli:main', + ] + }, classifiers=[ 'Programming Language :: Python', 'Programming Language :: Python :: 2.4', @@ -19,7 +27,10 @@ setup( description='A simple Python library for easily displaying tabular data in a visually appealing ASCII table format', author='Luke Maurits', author_email='luke@maurits.id.au', + maintainer='Kane Blueriver', + maintainer_email='kxxoling@gmail.com', url='http://code.google.com/p/prettytable', - py_modules=['prettytable'], - test_suite="prettytable_test" + py_modules=['prettytable', 'prettytable.cli', 'prettytable.prettytable', + 'prettytable.factory', 'prettytable._compact'], + test_suite="test_prettytable", ) |