Skip to content

Commit

Permalink
Add --version option to show abi3audit version information
Browse files Browse the repository at this point in the history
  • Loading branch information
wsfulton committed Nov 20, 2024
1 parent b45c880 commit 6c70ce4
Showing 1 changed file with 26 additions and 9 deletions.
35 changes: 26 additions & 9 deletions abi3audit/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,55 +175,72 @@ def main() -> None:
prog="abi3audit",
description="Scans Python extensions for abi3 violations and inconsistencies",
)
parser.add_argument(
version_group = parser.add_argument_group()
version_group.add_argument(
"-V",
"--version",
action="store_true",
help="show abi3audit version information",
)
main_group = parser.add_argument_group("main arguments")
main_group.add_argument(
"specs",
metavar="SPEC",
nargs="+",
nargs="*",
help="the files or other dependency specs to scan",
)
parser.add_argument(
main_group.add_argument(
"--debug",
action="store_true",
help=(
"emit debug statements; this setting also overrides `ABI3AUDIT_LOGLEVEL` and "
"is equivalent to setting it to `debug`"
),
)
parser.add_argument(
main_group.add_argument(
"-v",
"--verbose",
action="store_true",
help=("give more output, including pretty-printed results for each audit step"),
)
parser.add_argument(
main_group.add_argument(
"-R", "--report", action="store_true", help="generate a JSON report; uses --output"
)
parser.add_argument(
main_group.add_argument(
"-o",
"--output",
type=argparse.FileType("w"),
default=sys.stdout,
help="the path to write the JSON report to (default: stdout)",
)
parser.add_argument(
main_group.add_argument(
"-s",
"--summary",
action="store_true",
help="always output a summary even if there are no violations/ABI version mismatches",
)
parser.add_argument(
main_group.add_argument(
"-S",
"--strict",
action="store_true",
help="fail the entire audit if an individual audit step fails",
)
parser.add_argument(
main_group.add_argument(
"--assume-minimum-abi3",
action=_PyVersionAction,
help="assumed abi3 version (3.x, with x>=2) if it cannot be detected",
)
args = parser.parse_args()

if args.version:
from . import __version__

print(f"abi3audit {__version__}")
sys.exit(0)
else:
if len(args.specs) == 0:
console.log("[red]:thumbs_down: no input specs")

if args.debug:
logging.root.setLevel("DEBUG")

Expand Down

0 comments on commit 6c70ce4

Please sign in to comment.