File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed
Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -68,3 +68,9 @@ requires = ["setuptools>=64", "setuptools_scm>=8"]
6868
6969[tool .isort ]
7070profile = " black"
71+
72+ # Script entry points, i.e. command line commands available after installing the package
73+ # e.g. implemented using argparse
74+ # Then you can type: `python-package-hello -h` in the terminal
75+ [project .scripts ]
76+ python-package-hello = " python_package.cli:main"
Original file line number Diff line number Diff line change 1+ import argparse
2+
3+ from .mockup import hello_world
4+
5+
6+ def main ():
7+ parser = argparse .ArgumentParser (description = "Python Package CLI" )
8+ parser .add_argument (
9+ "-n" ,
10+ "--repeat" ,
11+ type = int ,
12+ default = 1 ,
13+ help = "Number of times to repeat the greeting hello world" ,
14+ )
15+ args = parser .parse_args ()
16+ msg = hello_world (args .repeat )
17+ print (msg )
You can’t perform that action at this time.
0 commit comments