Skip to content

Commit

Permalink
Make a couple changes to argument parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
ktbarrett committed Mar 13, 2024
1 parent 02e066f commit cb6e6e6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,18 @@ In that case the recommended usage is to simply call the script in a subprocess
The full help message:
```
> find_libpython --help
usage: find_libpython [-h] [--verbose] [--list-all | --candidate-names | --candidate-paths]
usage: find_libpython [-h] [-v] [--list-all | --candidate-names | --candidate-paths | --platform-info | --version]
Locate libpython associated with this Python executable.
optional arguments:
options:
-h, --help show this help message and exit
--verbose, -v Print debugging information.
-v, --verbose Print debugging information.
--list-all Print list of all paths found.
--candidate-names Print list of candidate names of libpython.
--candidate-paths Print list of candidate paths of libpython.
--platform-info Print information about the platform and exit.
--version show program's version number and exit
```

Usage as a library might occur when you need to obtain the path to the library in a Python-based build system like distutils.
Expand Down
9 changes: 4 additions & 5 deletions src/find_libpython/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,11 +426,7 @@ def main(args=None):

parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument(
"--verbose", "-v", action="store_true", help="Print debugging information."
)

parser.add_argument(
"--version", action="version", version=f"find_libpython {__version__}"
"-v", "--verbose", action="store_true", help="Print debugging information."
)

group = parser.add_mutually_exclusive_group()
Expand Down Expand Up @@ -462,6 +458,9 @@ def main(args=None):
const="platform-info",
help="Print information about the platform and exit.",
)
group.add_argument(
"--version", action="version", version=f"find_libpython {__version__}"
)

ns = parser.parse_args(args)
parser.exit(_cli_find_libpython(**vars(ns)))

0 comments on commit cb6e6e6

Please # to comment.