From 25b933801e206afe2498c00fb233f121a98a2cb0 Mon Sep 17 00:00:00 2001 From: Erik Nyquist Date: Wed, 11 Oct 2023 22:42:32 -0700 Subject: [PATCH] Add CLI script to setup.py, so 'duckargs' can be called directly --- README.rst | 7 ++++--- setup.py | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index 475ae9a..b65f9c5 100644 --- a/README.rst +++ b/README.rst @@ -28,12 +28,13 @@ Install with pip (python 3x required): Example ======= -Run duckargs from the command line via ``python -m duckargs``, followed by whatever arguments/options/flags -you want your program to accept, and ``duckargs`` will print the corresponding python code. +Run duckargs from the command line via ``duckargs`` or ``python -m duckargs``, followed +by whatever arguments/options/flags you want your program to accept, and ``duckargs`` +will print the corresponding python code. For example: :: - $ python -m duckargs positional_arg1 positional_arg2 -i --int-val 4 -f 3.3 -f --file FILE -F --otherfile FILE -a -b -c + $ duckargs positional_arg1 positional_arg2 -i --int-val 4 -f 3.3 -f --file FILE -F --otherfile FILE -a -b -c The output of the above command looks like this: diff --git a/setup.py b/setup.py index 599453f..d83a82f 100644 --- a/setup.py +++ b/setup.py @@ -39,6 +39,9 @@ def run(self): cmdclass={'test': RunDuckargsTests}, include_package_data=True, zip_safe=False, + entry_points = { + 'console_scripts': ['duckargs=duckargs.__main__:main'] + }, python_requires=">=3.7", classifiers=[ "Development Status :: 5 - Production/Stable",