diff --git a/opencage/command_line.py b/opencage/command_line.py new file mode 100644 index 0000000..2f6c8e9 --- /dev/null +++ b/opencage/command_line.py @@ -0,0 +1,4 @@ +from opencage.geocoder import OpenCageGeocode + +def main(): + print("Running opencage") diff --git a/setup.py b/setup.py index cb7e4fa..0c7ffef 100644 --- a/setup.py +++ b/setup.py @@ -37,6 +37,11 @@ url="https://github.com/OpenCageData/python-opencage-geocoder/", download_url="https://github.com/OpenCageData/python-opencage-geocoder/tarball/2.1.0", license="BSD", + entry_points={ + 'console_scripts': [ + 'opencage=opencage.command_line:main' + ] + }, packages=find_packages(), include_package_data=True, zip_safe=False, diff --git a/test/test_cli.py b/test/test_cli.py new file mode 100644 index 0000000..07b0e44 --- /dev/null +++ b/test/test_cli.py @@ -0,0 +1,9 @@ +import pytest +import httpretty + +from opencage.command_line import main + +def test_basic(capfd): + main() + out, err = capfd.readouterr() + assert out == "Running opencage\n"