mumoshu / variant2

Turn your bash scripts into a modern, single-executable CLI app today
MIT License
141 stars 11 forks source link

Add a version command #16

Open johncblandii opened 4 years ago

johncblandii commented 4 years ago

Feature

Add a command to see the version of the CLI.

> variant version
X.Y.Z
mumoshu commented 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!

osterman commented 4 years ago

Yep, some way to know what version is installed

johncblandii commented 4 years ago

Yep...exactly. We would do our own version management.

osterman commented 4 years ago

@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)?

mumoshu commented 4 years ago

@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.

osterman commented 4 years ago

thanks @mumoshu - makes sense to me now

Nuru commented 3 years ago

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.

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:

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}"