mirror of
https://github.com/semver/semver.git
synced 2026-07-11 06:53:03 -05:00
[GH-ISSUE #362] CLI convention: --version-semver #1135
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @AloisMahdal on GitHub (Apr 6, 2017).
Original GitHub issue: https://github.com/semver/semver/issues/362
Note: this is not intended as suggestion to change SemVer but rather as convention for people who already use SemVer and want to make as much use of it as possible.
Problem
It's a well-known convention for CLI tools to include
--versionoption that only causes the program to report its version and exit. It's not so common, however, to have the version information in predictable format. For example:Having extra info in the text may be useful but unless common format is kept, it's hard to consume the version number by scripts such as test harnesses or management tools.
Convention
Now some authors may decide to be more cooperative by implementing SemVer. These will obviously show SemVer-compatible version in the text. A nice convention would be to provide also option
--version-semver, which would be guarranteed to ouput only the SemVer-compatible version and nothing else. This option would normally accompany the "traditional"--versionoption, which could still include extra "free form" detail.Usage
Scripts intending to use other CLI tool versions could then use code such as:
@zafarkhaja commented on GitHub (Apr 7, 2017):
--version-semver, isn't it a duplication, how about --semver?
@AloisMahdal commented on GitHub (Apr 7, 2017):
It's intended to be subset of the
--versionnamespace. Version info is a very specific type of meta-data, so it's natural to have specific way of getting it. Also it's not really intended for humans (e. g. in interactive mode) so there's no real need to keep it short.Calling it
--semveris problematic.semveris IMO way too short to be recommendable for "all CLI tools in general". It might not sound probable but this particular cluster of six letters could have already other, completely unrelated meaning: "version" is not the only word starting with "ver" and "sem" is not the only word starting with "sem", and that's just one way of splitting it.A special case of this could be a tool which actually works in the domain of version information and management. Such tool could naturally already use this switch (or want to keep the option to use it for later).
This gets even worse when you realize that SemVer is not the only versioning standard out there. This convention could be pretty easily extended to any number of other versioning standards. But changing the convention to use the name directly breaks this extensibility.
(Also, you are a bit mixing apples with oranges here. It's no more duplication than phrase "SemVer version": both "version" and "semver" have different meaning; they rather specify each other rather than just repeat.)
@FichteFoll commented on GitHub (Apr 7, 2017):
Just make it - - semantic-version imo. I wanted to comment on the overall proposal as well, but lack the time currently.
@AloisMahdal commented on GitHub (Apr 8, 2017):
@FichteFoll Thanks for the comment but it does not seem convincing. You don't seem to reveal much about reasoning behind why "--semantic-version" would be better than my proposal "--version-semver". As I said in last comment, it's intentional to make it subset of the existing well-known namespace.
@krzysiekpiasecki commented on GitHub (Apr 8, 2017):
@AloisMahdal IMO the convention you are proposing is a bad idea. You propose an additional interface to return version information. Simplicity is achieved by removing interfaces rather than adding more in the name of greater flexibility. In addition, the presented script assumes that we take action according to the full version. This does not include components that will still need to be parsed anyway.
In sum. We have one
--versioninterface. Sometimes it will be a semantic implementation, sometimes it will not. This is aconvention. If someone wants more, he will designate himself.@AloisMahdal commented on GitHub (Apr 10, 2017):
@krzysiekpiasecki I agree that the less is better. This is actually meant for people who want more but rather than everyone come up with own spelling (
--semver,--semantic-version), the "less" is in offering universal spelling that could work for all. So in its way this is application of the same principle.About the "want more": the main motivation for this was in context of automated testing. I was developing a test harness and I wanted to show version of the tested module as part of the log, but keep the parsing code as trivial as possible (as every test-related code should strive for) without sacrificing the conventional
--versionwhich I already used for human-readable information. It's worth noting that there was already assumption that the version itself does say enough; if that's not the case, you will indeed designate yourself.(That said, your comment did make me think a bit more critical about this proposal.)
@jwdonahue commented on GitHub (Nov 28, 2017):
This is an interesting idea that belongs to the realm of things that layer on top of SemVer. Until such layers are established and adopted, there is no point in attempting to be proscriptive from within the SemVer spec. Let's let SemVer be one simple node in the web of evolving dev-ops standards, keep it simple, but not too simple.
I vote to close this issue.
@AloisMahdal commented on GitHub (Nov 28, 2017):
@jwdonahue See Note in the header of the original post. By any stretch, this was never intended to be part of SemVer. Original SemVer points to this issue tracker as a means to "leave feedback" and as you can see, the tracker has been already used for many years as medium for discussions about both SemVer and conventions built above it.
@jwdonahue commented on GitHub (Nov 28, 2017):
@AloisMahdal, what/where is this "Original SemVer"? Please forgive my ignorance, I am still stumbling around a bit here at GitHub. When I see open issues, I see technical debt and have a strong desire to drive it to zero. I am all for drawing attention here to other sites and ideas, I just don't see the point in leaving this on the list of SemVer open issues. Until I chimed in, there has been no activity on this issue since April.
@AloisMahdal commented on GitHub (Nov 28, 2017):
@jwdonahue welcome to GitHub. Good spirit is welcome, but please note that this is a very diverse communty with very diverse practices; basically each project can have its own rules. So don't fall into the illusion that the only reason for an issue being open (and inactive) is because people forgot about it. It's perfectly OK for an issue to be open for years; not all issues represent a technical debt.
Generally, people will be happy if you want to contribute to their project but they will want you to get familiar with contributing guidelines first. (If an issue is affecting you, though, it's OK to just politely ask about the state :-)).
(Note: I'm not even representing community around SemVer; It was only after carefully reading many other issues and discussion that I decided that the tracker might be the right place for my own suggestion.)
In short, we are all guests here.
@jwdonahue commented on GitHub (Nov 29, 2017):
@AloisMahdal, I've started another issue to discuss this, rather than further pollute your topic.
@alexandrtovmach commented on GitHub (Jun 10, 2020):
Closed as resolved, thanks everyone for contribution 👍
@AloisMahdal If you still have any questions, feel free to re-open
@AloisMahdal commented on GitHub (Jun 11, 2020):
FTR, I have to admit that over past years I wrote dozens of CLI's but I haven't implemented this convention anywhere. I always used
-Vfor -- just (parseable) SemVer, and--versionfor perhaps something more chatty.I think the best argument against my past self would be: if
--version-semveronly works if consumer knows it exists (and what it means). Ie. there has to be pre-existing contract about CLI. If one wants to have such contract then it could be--versionor-Vright away, coupled with expectation that it has to be SemVer data.The use case I had in mind when proposing this could still arguably make use of it: I was imagining a framework that would wrap CLI's in other interfaces, so for reporting version there would have to be such interface. (And
--versioncould be already "occupied" by a "chatty version", and-Vis too short.)I think the reason I've never used this is that for all practical purposes it works way better to communicate version info using proper config management or package management, such as rpm, dpkg, etc. If only because it works regardless of CLI. IOW, it's unlikely that such framework would exist without relying on proper management like that so using CLI for that would be duplication.
(OTOH, that's also why I never used
module.VERSIONconvention in Python, and yet I think their packaging still supports it.)