feat: Add script functions that indicate results with the exit code#8
Merged
feat: Add script functions that indicate results with the exit code#8
Conversation
- `compare` compares two symvers and return 0 if the first is less than the second, 1 if they are equal, and 2 if the first is greater than the second. - `released` Returns 0 if the if the given version is a release version, and 1 if it is not.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces two new CLI commands—"compare" and "released"—to provide script utilities for semantic versioning by using exit codes for status indication.
- Added CompareVersions and IsReleased functions with associated tests in cmd/script_test.go.
- Integrated new commands into the CLI via scriptCmd in cmd/script.go and registered them in cmd/root.go.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| cmd/script_test.go | Includes test cases for comparing and verifying semantic versions. |
| cmd/script.go | Implements CompareVersions and IsReleased functions along with compare and released subcommands. |
| cmd/root.go | Registers the new script command with the root command. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
comparecompares two symvers and return 0 if the first is less than the second, 1 if they are equal, and 2 if the first is greater than the second.releasedReturns 0 if the if the given version is a release version, and 1 if it is not.