Giter VIP home page Giter VIP logo

semver's Introduction

semver

semver is a command-line tool to parse "Semantic Versioning 2.0.0".

Install

Go is required to install semver. Please run go get as follows.

$ go install github.com/masa213f/semver/cmd/[email protected]

Usage

Specify the version number (string) as the argument of semver. If the version number is parsed successfully, this command outputs the result as follows. At this time, 0 is returned as the exit status.

$ semver v1.2.3-rc.0+build.20190925
prefix: v
version: 1.2.3-rc.0+build.20190925
major: 1
minor: 2
patch: 3
prerelease: rc.0
build: build.20190925
# => exit status: 0

If you specify the --json option, the result will be output in JSON format.

$ semver v1.2.3-rc.0+build.20190925 --json
{
  "prefix": "v",
  "version": "1.2.3-rc.0+build.20190925",
  "major": 1,
  "minor": 2,
  "patch": 3,
  "prerelease": [
    "rc",
    "0"
  ],
  "build": [
    "build",
    "20190925"
  ]
}
# => exit status: 0

If the argument does not follow "Semantic Versioning 2.0.0", 1 will be returned as the exit status.

$ semver v1.12
parse error: format error
# => exit status: 1

$ semver v1.01.0
parse error: invalid numeric identifier (leading zeros): minor = 01
# => exit status: 1

You can also specify the -p(--is-prerelease) option to determine the pre-release version.

$ semver -p v1.1.2-rc.0
prerelease: rc.0
# => exit status: 0

$ semver -p v1.1.2
official version: version = 1.1.2
# => exit status: 2

semver's People

Contributors

masa213f avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.