From 9f4a4fee5cb62a101075adf3054832cdb1e6a5ad Mon Sep 17 00:00:00 2001 From: nicoo Date: Thu, 12 Sep 2024 12:04:09 +0000 Subject: [PATCH] setup.py: define an entrypoint for the CLI This way, a `unicodeit` executable will be generated, which just stubs out to `unicodeit.cli`. --- setup.py | 6 ++++++ unicodeit/cli.py | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index b6d4ce7..26e27fe 100644 --- a/setup.py +++ b/setup.py @@ -30,4 +30,10 @@ 'pycodestyle', ], }, + + entry_points={ + 'console_scripts': [ + 'unicodeit = unicodeit.cli:main', + ], + }, ) diff --git a/unicodeit/cli.py b/unicodeit/cli.py index 2d009b6..fa43ec9 100644 --- a/unicodeit/cli.py +++ b/unicodeit/cli.py @@ -3,6 +3,9 @@ from .replace import replace -if __name__ == "__main__": +def main(): result = [replace(f) for f in sys.argv[1:]] print(' '.join(result)) + +if __name__ == "__main__": + main()