feat(service): add -v version flag to print version and OS/arch info#53
feat(service): add -v version flag to print version and OS/arch info#53ranganath42 wants to merge 4 commits into
Conversation
1c5879c to
ee629ef
Compare
| "delete": "uninstall", | ||
| "check": "validate", | ||
| "test": "validate", | ||
| "v": "version", |
There was a problem hiding this comment.
Is this required? It's an abbreviation rather than an alias.
There was a problem hiding this comment.
True, not exactly an alias, but rather a short flag.
It's convenient, though. The options are to,
- Explicitly normalize -
vinnormalizeArgs - Refactor to Go's standard flag package
I would like to postpone the refactor to a later pull request. Do you think explicitly handling -v in normalizeArgs is better?
There was a problem hiding this comment.
I believe you want to allow version or -v as the command-line flag to display the version.
However, if v is set to the aliases, "v" is also a valid argument.
There was a problem hiding this comment.
Yup, I wanted to support the short flag v, just like with the updater. Currently, this is the easiest, even though it is not the most idiomatic way.
There was a problem hiding this comment.
Does the updater support the v? I thought it was -v.
I don't see the need for the v option. If -v should be supported as other command-line tools, we should use an approriate way.
There was a problem hiding this comment.
I see your point. I'll remove both short flags (v/-v) and only keep version to match the rest of the subcommands in the service binary.
| // 3. Fallback "dev" for unflagged local development builds. | ||
| func resolveVersion(flagVersion string) string { | ||
| if flagVersion != "" { | ||
| return strings.TrimPrefix(flagVersion, "v") |
There was a problem hiding this comment.
- I don't think we should modify a specified value
- Why
SILVER_VERSIONandSILVER_RELEASEE_TAGneeds to be handled here. We don't provide a CI build.
There was a problem hiding this comment.
Yup. This is a convenient method for a CI/CD to embed the version.
There was a problem hiding this comment.
My thinking is that if the environment varibale can be set, the comnad-line flag also can be set. Therefore, the version being embedded into a binarty doesn't need to be set via the environment variable.
Adds a -v (version) CLI flag to the Silver service binary to display version and OS/architecture details in standard Go format.
The version flag executes early before config loading, enabling quick host compatibility checks.
Examples.
silver version 1.0.0 darwin/amd64silver version 1.7.0 linux/amd64silver version 1.7.0 windows/amd64silver version dev darwin/arm64