Skip to content

feat: add --version flag to the CLI#303

Open
ETM-Code wants to merge 1 commit into
D4Vinci:devfrom
ETM-Code:feat/cli-version-flag
Open

feat: add --version flag to the CLI#303
ETM-Code wants to merge 1 commit into
D4Vinci:devfrom
ETM-Code:feat/cli-version-flag

Conversation

@ETM-Code
Copy link
Copy Markdown

What

Adds a --version flag to the scrapling CLI, as requested in #299.

$ scrapling --version
Scrapling, version 0.4.8

How

  • Decorates the top-level main group with click's version_option, sourcing the version from scrapling.__version__ and using prog_name="Scrapling" so the output matches the format requested in the issue.
  • Adds a test_version_flag test to tests/cli/test_cli.py asserting exit code 0 and the exact output string.

Notes

  • No new dependencies (version_option ships with click, which is already a CLI requirement).
  • Targets the dev branch per CONTRIBUTING.md.
  • ruff check, ruff format --check (cli.py), vermin, and bandit pass on the changed code; the full tests/cli/test_cli.py suite passes locally.

Closes #299

- Add a `--version` flag to the main CLI group using click's `version_option`
- Prints `Scrapling, version <version>` and exits, sourcing the version from `scrapling.__version__`
- Add a CLI test asserting the flag's output

Closes D4Vinci#299
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