Giter VIP home page Giter VIP logo

cargo-v's Introduction

Welcome to cargo-v ๐Ÿ‘‹

All Contributors

Documentation License: MIT Twitter: fdaciuk

An easy way to update the version of your package

๐Ÿ  Homepage

Install

cargo install cargo-v

This CLI is intended to update the version of your package using the SemVer.

Important note

Before using this CLI, make sure you:

  • run the cargo build command to ensure your package doesn't have any errors;
  • have committed all important files (including Cargo.toml and Cargo.lock, that will be "git added" automatically by the CLI);

Usage

You can update the version of your project using the command:

cargo v <version>

Where <version> can be one of patch, minor, major or a complete string version like v1.1.0 or just 1.1.0.

You can use <version> just as a partial string version like 2 or 2.1, that is the same as v2.0.0 and v2.1.0 respectively.

The above command will do:

  • update the string version of your package from Cargo.toml;
  • update the string version of your package from Cargo.lock;
  • create a git commit with new version;
  • and create a git tag with new version.

Before do a git commit and git tag, you will be asked if everything is ok with your project. To automatically answer yes to all questions, just use the flag -y or --yes:

cargo v <version> -y

To see all possible options, just run cargo v --help.

Author

๐Ÿ‘ค Fernando Daciuk

๐Ÿค Contributing

Contributions, issues and feature requests are welcome!

Feel free to check issues page.

โœจ Contributors

Thanks goes to these wonderful people (emoji key):


Fernando Daciuk

๐Ÿ’ป ๐Ÿ“–

Matheus Henrique

๐Ÿ’ป ๐Ÿ“–

This project follows the all-contributors specification. Contributions of any kind welcome!

Show your support

Give a โญ๏ธ if this project helped you!

๐Ÿ“ License

Copyright ยฉ 2022 Fernando Daciuk.

This project is MIT licensed.


This README was generated with โค๏ธ by readme-md-generator

cargo-v's People

Contributors

allcontributors[bot] avatar fdaciuk avatar mxthevs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cargo-v's Issues

Accept manual pre-release version

About pre-releases

We can accept something like:

cargo v 2.0.0-alpha.1
cargo v 2.0.0-beta.1
cargo v 2.0.0-rc.1

Only full versions should be accepted, and the major version defined must be greater than the current version.

Refactoring

Let's do some refactoring in our code following the tips from @togglebyte:

Part 1: https://www.twitch.tv/videos/1497045321
Part 2: https://www.twitch.tv/videos/1497077319


  • Improve the way we communicate how the CLI works (maybe using a table instead of long descriptions)
  • In documentation, make it clear that a commit and a git tag will be created, so before using cargo-v, the dev should make sure that there is nothing else to commit, and the project is building properly.
  • Write error messages starting with lowercase letters
  • Maybe a single letter for CLI is not a good ideia (but ver and version are already taken, so, I'm open to suggestions :D)
  • Fix cargo clippy warnings
  • Have to continue from here

Documentation

Create a documentation on README.md and using Rust comments.

Accept `metadata`

About metadata

Current version must remain the same and precedence must be ignored.

Examples:

Current version: 2.0.0

  • Command: cargo v meta 123456.1.8.9
  • Result: 2.0.0+123456.1.8.9

Current version: 2.0.0-alpha.1

  • Command: cargo v meta git.123456
  • Result: 2.0.0-alpha.1+git.123456

Current version: 2.0.0

  • Command: cargo v meta git.123456-abc.1.2-890.1
  • Result: 2.0.0+git.123456-abc.1.2-890.1

Accept pre-release labels

We should accept the labels alpha, beta and rc labels (using this precedence).

Examples:

cargo v alpha

This command will add a -alpha.1 next to patch version or increase the number after -alpha..

  • If current version is 1.0.0, the result must be 1.0.0-alpha.1.
  • If current version is 1.0.0-alpha.2, the result must be 1.0.0-alpha.3;
  • If current version is 1.0.0-beta.1, the command above should result in an error: you can't decrease a version.

The same can be done with beta and rc labels.

Improve the way we update version in `Cargo.toml` and `Cargo.lock`

  • Dependencies in Cargo.toml can have a version entry. We should not change this version, only the version inside the [package] section.
  • Update the version inside Cargo.lock without a build.
  • Update src/lib.rs to use our parser.
  • Stop using build to update Cargo.lock
  • Export all functions from parser to import from cargo_v (pub use parser::* in src/lib.rs)
  • Update src/main.rs to use our parser.

Accept `patch`, `minor` and `major` as arguments

cargo-v CLI should read the file Cargo.toml and accept patch, minor and major as arguments:

# In version 0.0.1, should increment the latest number to 0.0.2
cargo v patch

# In version 0.0.2, should increment the second number and reset the latest one to 0.1.0
cargo v minor

# In version 0.1.1, should increment the first number and reset the second and latest ones to 1.0.0
cargo v major

Show questions before commit and create git tag

After we run cargo v <version>, before create commit and git tag, we should ask some questions:

  • All important files are git added and commited (specially Cargo.toml and Cargo.lock)? [Y]es [N]o
  • Have you already run the command cargo build? [Y]es [N]o
  • ?

After all y answers, we can continue safely. If any No is answered, we should abort.

We can add an Operation option -y or --yes to automatically answer Yes for all questions.

Accept a manual version as argument

cargo-v CLI should read the file Cargo.toml and accept a manual version that may or may not start with v:

# The two following examples should have the same behaviour (always add a `v`):
cargo v v1.0.0
cargo v 1.0.0

We must ensure that the input version is greater than the current version.

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.