Skip to content

feat: add --version/-v flag to sql2json CLI - #27

Merged
fsistemas merged 1 commit into
masterfrom
feature/FRA-254
Jun 24, 2026
Merged

feat: add --version/-v flag to sql2json CLI#27
fsistemas merged 1 commit into
masterfrom
feature/FRA-254

Conversation

@fsistemas

Copy link
Copy Markdown
Owner

Summary

Adds a --version / -v flag to the sql2json CLI. Previously sql2json --version tried to run a query named version and failed with a config error.

sql2json --version
# → sql2json 0.3.0
sql2json -v
# → sql2json 0.3.0

The check runs in main() before fire.Fire(), so it short-circuits all normal query execution, prints sql2json <version> to stdout, and exits 0. Version comes from the existing __version__ (importlib.metadata).

Tests

New TestVersion class in tests/test_cli.py (runs the real CLI as a subprocess):

  • --version and -v each exit 0 and print sql2json <version>
  • no query runs / stderr is empty
  • short-circuits before config is read (works with a missing --config path)
  • works when combined with other flags (--name/--query)

Version is asserted against sql2json.__version__, so tests survive version bumps. Full suite (145) and flake8 pass.

Docs

Updated README.md, AGENTS.md, skills/sql2json/SKILL.md, and CHANGELOG.md (Unreleased → Added).

@fsistemas
fsistemas merged commit 2c0a33f into master Jun 24, 2026
6 checks passed
@fsistemas
fsistemas deleted the feature/FRA-254 branch June 24, 2026 02:14
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