-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add ability to check DefraDB CLI version. #339
Conversation
``` Usage: defradb version [flags] Flags: --f string The version's format can be one of: 'short', 'json' ``` Example [default]: >> `defradb version` ``` DefraDB's Version Information: * 🏷 version tag = 0.2.1 * # build commit = e4328e0 * 📅 release date = 2022-03-07T00:12:07Z ``` Example [short flag]: >> `defradb version --f short` ``` 0.2.1 ``` Example [json flag]: >> `defradb version --f json` ```{"tag":"0.2.1","commit":"e4328e0","date":"2022-03-07T00:12:07Z"}```
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks really nice :) I do question slightly as to whether it is worth an extra 3rd party dependency though - but will trust your decision on that
Are you referring to color support ( |
There is actually one thing we have to have a discussion on. The commit hash that is returned for the version probably shouldn't be hardcoded. Because the releasing tag commit (final commit) will not know it's own hash in advance to place in the commit (as commit hashes dependent on the time the commit happened at and who made the commit). The other approach might be to put the hash of one commit before the released tag. |
Yes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM :)
I want to add that I'll provide an update to the implementation as part the CLI overhaul I'm working on to include things like
- top-level
version
package to have default version information of potentially multiple components - Makefile -> git describe -> build tags defining defradb version variable
- as part of the configuration overhaul i'm introducing a
--no-color
which will conditionally turn off the coloring, and an output global flag (text, json) to globally decide on the default output type used
I think the added color dependency looks fine - convenient, popular/supported, probably not heavy
terminals that don't support emoji icons.
Is this worth pursuing if @orpheuslummis plans on re-implementing it as the CLI overhaul. My approach for this would be a dedicated and |
I have added these to #349 For now as we already have users that are starting to use Defra so I think that merging this is fine as it offers them (those building from source) a quick way to see they are indeed on v0.2.1. This should be a fairly easy refactor / cleanup todo for @orpheuslummis when they decide on
Unless there is strong opposition to merging this in, I would say it's okay to merge it for now gives the feature quickly for people using and can be built on top of (depending on which ld flag approach is picked) |
Agree perfectly with this assessment! Lets merge this now as a short term and rework as we need/arrive with the CLI refactor. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Adds the ability to check DefraDB's latest release version. Resolves sourcenetwork#259 ``` Usage: defradb version [flags] Flags: -f, --format string The version's format can be one of: 'short', 'json' ``` Example [default]: >> `defradb version` ``` DefraDB's Version Information: * version tag = 0.2.1 * build commit = e4328e0 * release date = 2022-03-07T00:12:07Z ``` Example [short flag]: ``` >> $ defradb version -f short 0.2.1 ``` Example [json flag]: ``` >> $ defradb version --format json {"tag":"0.2.1","commit":"e4328e0","date":"2022-03-07T00:12:07Z"} ```
Adds the ability to check DefraDB's latest release version.
Resolves #259
Example [default]:
Example [short flag]:
Example [json flag]: