Skip to content

Add --version option to gpt-copy CLI command#33

Merged
simone-viozzi merged 2 commits intomainfrom
copilot/fix-32
Aug 3, 2025
Merged

Add --version option to gpt-copy CLI command#33
simone-viozzi merged 2 commits intomainfrom
copilot/fix-32

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Aug 3, 2025

This PR adds support for the --version option to the gpt-copy CLI tool. Previously, running gpt-copy --version would result in an error:

❯ gpt-copy --version
Usage: gpt-copy [OPTIONS] ROOT_PATH
Try 'gpt-copy --help' for help.

Error: No such option: --version

After this change, the command now works as expected:

❯ gpt-copy --version
gpt-copy, version 2.4.0

Implementation Details

The implementation uses Click's built-in @click.version_option() decorator with importlib.metadata to dynamically retrieve the version from the package metadata. This ensures the version displayed is always consistent with what's defined in pyproject.toml without requiring manual synchronization.

Changes made:

  • Added importlib.metadata import to src/gpt_copy/gpt_copy.py
  • Added @click.version_option(version=importlib.metadata.version("gpt_copy")) decorator to the main CLI command
  • Created comprehensive tests in tests/test_version_option.py to verify the functionality

The --version option is now properly displayed in the help output and follows standard CLI conventions by printing the version and exiting with code 0.

Fixes #32.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • openaipublic.blob.core.windows.net
    • Triggering command: /usr/bin/python /tmp/tmph0kzzq5h.py /tmp/tmpe1effsan --tokens (dns block)
    • Triggering command: /usr/bin/python /tmp/tmpjdzgbc4i.py /tmp/tmpvqwhr3wq --tokens --top-n 2 (dns block)
    • Triggering command: /usr/bin/python /tmp/tmpkon9knoy.py /tmp/tmpwbps19jd --tokens --include *.py (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Co-authored-by: simone-viozzi <19674168+simone-viozzi@users.noreply.github.com>
Copilot AI changed the title [WIP] add --version option Add --version option to gpt-copy CLI command Aug 3, 2025
Copilot AI requested a review from simone-viozzi August 3, 2025 14:02
@simone-viozzi simone-viozzi marked this pull request as ready for review August 3, 2025 16:27
@simone-viozzi simone-viozzi merged commit 77604f6 into main Aug 3, 2025
@simone-viozzi simone-viozzi deleted the copilot/fix-32 branch August 3, 2025 16:27
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.

add --version option

2 participants