Skip to content

fix(cli): support lowercase version flag - #289

Closed
Junior (seilorjunior) wants to merge 1 commit into
Azure:mainfrom
seilorjunior:fix/224-version-alias
Closed

Junior (seilorjunior) wants to merge 1 commit into
Azure:mainfrom
seilorjunior:fix/224-version-alias

Conversation

@seilorjunior

Copy link
Copy Markdown

Register -v using Commander's version handler while preserving -V and --version. Cover all three forms through the actual CLI entry point.

Closes #224
This pull request enhances the CLI tool's version flag support and updates the related tests to ensure correct behavior. The main focus is to support both short and long version flags for user convenience.

CLI usability improvements

  • Added support for the -v short flag (in addition to the existing --version and -V flags) to display the CLI version in src/cli/index.ts.

Testing improvements

  • Updated the CLI entry point tests in index.test.ts to verify that all version flags (-v, -V, and --version) correctly output the version, and that no errors are printed to stderr.

Register -v using Commander's version handler while preserving -V and
--version. Cover all three forms through the actual CLI entry point.

Closes Azure#224

Co-authored-by: GitHub Copilot <noreply@github.com>
Copilot AI balanced review requested due to automatic review settings September 17, 2026 18:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The -v alias is not currently registered, so the requested behavior remains broken.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds lowercase -v CLI version support while retaining -V and --version, with entry-point test coverage.

Changes:

  • Updates CLI version-option registration.
  • Tests all three version flags and output behavior.
File summaries
File Summary
tests/unit/cli/index.test.ts Covers -v, -V, and --version.
src/cli/index.ts Configures CLI version flags; -v still requires explicit registration.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite (auto)

Note

Copilot is running an experiment and ran this review at Lite.


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/cli/index.ts
Comment on lines +23 to 24
.version(packageJson.version, '-v')
.version(packageJson.version)
@azaslonov

Copy link
Copy Markdown
Member

Thank you for this fix, Junior (@seilorjunior)! The same change for #224 (adding -v alongside -V and --version) has already landed on main via #298, so I'm closing this PR as superseded. Sorry for the overlap, and we appreciate the contribution.

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.

CLI flags should not be case-sensitive (apiops -v fails, -V works)

3 participants