diff --git a/Changelog b/Changelog index 5a2f679..9c5f936 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,6 @@ +# 1.2.2 +* Added `qrprint` as a CLI application to print QR codes to the terminal. + # 1.2.1 * Fixed issue #43. A debug print statement got left in by mistake. I altered The distribution script to check and make sure it does not happen again. diff --git a/pyqrcode/qrprint.py b/pyqrcode/qrprint.py new file mode 100644 index 0000000..6915b6f --- /dev/null +++ b/pyqrcode/qrprint.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +# Released into the public domain by Teran McKinney. +""" +qrprint: CLI application for PyQRCode to print a QR code into a terminal. +""" + +import argparse + +import pyqrcode + + +def main(): + """ + Where we should be called. Just a CLI application, no use using this as + a library. + """ + parser = argparse.ArgumentParser() + parser.add_argument('text', help='text for QR code') + parser.add_argument('--module_color', + help='Sets QR code data module color', + default='default') + parser.add_argument('--background', + help='Sets QR code background', + default='reverse') + parser.add_argument('--quiet_zone', + help='Sets QR code quiet zone', + default=4) + args = parser.parse_args() + qr = pyqrcode.create(args.text) + print(qr.terminal(module_color=args.module_color, + background=args.background, + quiet_zone=args.quiet_zone)) + return True + +if __name__ == '__main__': + main() diff --git a/setup.py b/setup.py index 9fac429..ffa0721 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ # * Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. -# * Neither the name of the copyright holder nor the names of its +# * Neither the name of the copyright holder nor the names of its # contributors may be used to endorse or promote products derived from # this software without specific prior written permission # @@ -25,7 +25,7 @@ from setuptools import setup import sys, os.path, shutil -version = '1.2.1' +version = '1.2.2' if sys.version_info < (2, 6, 0) and sys.version_info < (3, 0, 0): sys.stderr.write("pyqrcode requires Python 2.6+ or 3.\n") @@ -37,7 +37,7 @@ #source. if os.path.exists('docs/README.rst'): print('Reading README.rst file') - with open( 'docs/README.rst', 'r') as f: + with open('docs/README.rst', 'r') as f: longdesc = f.read() shutil.copyfile('docs/README.rst', 'README.rst') else: @@ -52,10 +52,15 @@ url='https://github.com/mnooner256/pyqrcode', keywords=['qrcode', 'qr'], license='BSD', - extras_require = { + extras_require={ 'PNG': ["pypng>=0.0.13"], }, - classifiers = [ + entry_points={ + 'console_scripts': [ + 'qrprint = pyqrcode.qrprint:main' + ] + }, + classifier=[ 'Development Status :: 4 - Beta', 'Environment :: Console', 'Intended Audience :: Developers',