Open johncblandii opened 4 years ago
@johncblandii It's the version number of the Variant itself, not that of your own command, right? If so, it makes sense!
Yep, some way to know what version is installed
Yep...exactly. We would do our own version management.
@mumoshu I know you're concerned about polluting the arg space with variant commands and options. Maybe time to consider a "reserved" prefix (e.g. --variant-version
, --variant-help
, etc)?
@osterman Thanks!
But no. In Variant 2, variant run
or ./yourshim
is used as the entry point for all the user-defined commands and flags.
So the user-defined one would be just variant run version
or /yourshim version
, where the variant's reserved one would be variant version
.
In case you need to include the version number of Varaint in the output of variant run version
, it would be better to expose it via a builtin variable like context.variantver
.
thanks @mumoshu - makes sense to me now
In case you need to include the version number of Varaint in the output of
variant run version
, it would be better to expose it via a builtin variable likecontext.variantver
.
Please expand more on this idea of context.variantver
or better yet, fully document context (See #50).
I would like to be able to display both the version of Variant my command is using and the version of my command. One possible solution:
main
declare string variables version
and variantversion
variantversion
to the version of Variant using whatever mechanism you want, so long as variant export
preserves the variantversion
valuevariant version
command that outputs main.variantversion
context
or via some function, both version
and variantversion
. If version
is unset or empty, replace it with variantversion
This would (a) allow you to have a variant version
command as requested, and (b) allow me to set a command version
through the linker via
go build -ldflags "-X main.version=${MY_COMMAND_VERSION}"
Feature
Add a command to see the version of the CLI.