diff --git a/bin/colout b/bin/colout deleted file mode 100644 index 7702d17..0000000 --- a/bin/colout +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -# Copyright (c) 2013 Martin Ueding - -# Small launcher script for the main module. - -# Licence: GPL 3 - -set -e -set -u - -python3 -m colout.colout "$@" diff --git a/colout/colout.py b/colout/colout.py index 29ca071..052d77e 100755 --- a/colout/colout.py +++ b/colout/colout.py @@ -927,8 +927,8 @@ def write_all( as_all, stream_in, stream_out, function, *args ): map_write( stream_in, stream_out, function, *args ) -if __name__ == "__main__": - +def main(): + global context error_codes = {"UnknownColor":1, "DuplicatedPalette":2, "MixedModes":3} usage = "A regular expression based formatter that color up an arbitrary text stream." @@ -1108,3 +1108,6 @@ if __name__ == "__main__": + " Check the following 'color:mode' pairs: %s." % e ) sys.exit( error_codes["MixedModes"] ) + +if __name__ == "__main__": + main() diff --git a/setup.py b/setup.py index 890b887..d844893 100644 --- a/setup.py +++ b/setup.py @@ -36,6 +36,9 @@ setup( use_scm_version=True, classifiers=classifiers, description='Color Up Arbitrary Command Output.', + entry_points={ + 'console_scripts': ['colout=colout.colout:main'], + }, long_description=open('README.md').read(), author='nojhan', author_email='nojhan@nojhan.net', @@ -43,7 +46,6 @@ setup( packages=packages, package_data={'': ['LICENSE', 'README.md']}, package_dir={'colout': 'colout'}, - scripts=['bin/colout'], setup_requires=setup_requires, include_package_data=True, install_requires=requires,