Merged
Conversation
- Added version field to clap command configuration using env!('CARGO_PKG_VERSION')
- Added comprehensive tests for both --version and -V flags
- Version option displays 'envsense X.Y.Z' format
- Maintains compatibility with existing CLI functionality
Contributor
There was a problem hiding this comment.
Pull Request Overview
Adds a standard --version option to the envsense CLI that displays the current version of the tool by leveraging Cargo's built-in version information.
- Added version support to the CLI using
env!("CARGO_PKG_VERSION")macro - Implemented comprehensive testing for both long and short version flags
- Maintains backward compatibility with existing CLI functionality
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/main.rs | Added version attribute to clap command configuration |
| tests/cli.rs | Added two test functions to verify version flag functionality |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
--versionoption to the envsense CLI that displays the current version of the tool.Changes
#[command]attribute insrc/main.rsto includeversion = env!("CARGO_PKG_VERSION")tests/cli.rs:version_flag_displays_version()- tests--versionversion_short_flag_displays_version()- tests-VKey Features
env!("CARGO_PKG_VERSION")to pull version fromCargo.toml--versionand-Vflags (clap default)envsense X.Y.ZformatTesting
Example Output
This implements a standard CLI version option following Rust/clap best practices.