Code Monkey home page Code Monkey logo

semver-compare-cli's Introduction

semver-compare-cli

standard-readme compliant

CLI wrapper of the semver-compare library

Compare two semver version strings on the command line. The exit code is 0 (equal), 1 (greater), or 2 (smaller). In addition, a predicate can be added that's applied when comparing the two version.

The project is a wrapper around the semver-compare library.

Table of Contents

Install

Install via npm:

yarn global add semver-compare-cli

or use deno to run it without installation:

deno run https://cdn.deno.land/semver_compare_cli/versions/v2.0.0/raw/semver-compare.js

Usage

Direct comparison

For a direct comparison of two versions the following exit codes are possible:

  • 0 versions are equal
  • 1 the first version is larger than the second version
  • 2 the first version is smaller than the second version

Example, exit code is 2 because the first version is smaller than the second version:

semver-compare 1.0.0 1.0.1

Comparison with predicate

For a comparison with a predicate the following exit codes are possible:

  • 0 predicate applies to the comparison of the two version
  • 1 predicate doesn't apply

The following predicates are supported that shall be placed between the two version numbers:

  • eq: equal
  • ge: greater than or equal
  • gt: greater than
  • le: lower than or equal
  • lt: lower than

Example, exit code is 1 because the first version is smaller than the second version:

semver-compare 1.0.0 ge 1.0.1

Maintainers

@jceb

Contributing

PRs accepted.

Small note: If editing the README, please conform to the standard-readme specification.

License

MIT © 2021 Jan Christoph Ebersbach [email protected]

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.