diff options
author | kxxoling <kxxoling@gmail.com> | 2015-05-01 23:12:27 +0800 |
---|---|---|
committer | kxxoling <kxxoling@gmail.com> | 2015-05-01 23:12:27 +0800 |
commit | 064d11c6b771989127642e8c5778a0820520dda0 (patch) | |
tree | 50168316b374e56ddd59bdf109cd6d84d2f9169e | |
parent | 557a0494101ad8fad8f8ac1ed60a20cb1042b7c0 (diff) | |
download | python-prettytable-ptable-064d11c6b771989127642e8c5778a0820520dda0.tar.gz |
Add a simple command line support
-rw-r--r-- | prettytable/cli.py | 16 | ||||
-rw-r--r-- | setup.py | 15 |
2 files changed, 29 insertions, 2 deletions
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", ) |