Skip to content

feat: add --version/-v flag and validate --root-dir exists in CLI - #389

Open
pro-laxmi wants to merge 1 commit into
python-distro:masterfrom
pro-laxmi:feat/cli-version-and-rootdir-validation
Open

pro-laxmi wants to merge 1 commit into
python-distro:masterfrom
pro-laxmi:feat/cli-version-and-rootdir-validation

Conversation

@pro-laxmi

Copy link
Copy Markdown

Summary of Changes

  1. Added --version / -v flag to the distro CLI, printing %(prog)s <version> and exiting cleanly.
  2. Added directory validation for --root-dir: if a user supplies a non-existent path or non-directory, argparse now issues a clean error (parser.error) instead of silently returning empty/None distribution metadata.

Verification & Testing

python3 -m distro --version
# Output: python3 -m distro 1.9.0

python3 -m distro --root-dir /nonexistent_path
# Output: python3 -m distro: error: Root directory '/nonexistent_path' does not exist or is not a directory

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant