-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
865790a
commit 5520fe8
Showing
2 changed files
with
101 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2015 Frédéric Maquin <[email protected]> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,86 @@ | ||
# cargo-semver | ||
|
||
[![crates.io](https://img.shields.io/crates/v/cargo-semver)](https://codecov.io/gh/filipstefansson/cargo-semver) | ||
[![codecov](https://codecov.io/gh/filipstefansson/cargo-semver/branch/master/graph/badge.svg?token=HSAldVxPvX)](https://codecov.io/gh/filipstefansson/cargo-semver) | ||
|
||
**cargo-semver** is a cargo subcommand to help you update the version in your `Cargo.toml` file. | ||
|
||
- Update the version with `cargo semver major|minor|patch|pre` | ||
- Set a custom version with `cargo semver set 1.0.1` | ||
```console | ||
$ cargo semver | ||
1.0.0 | ||
|
||
$ cargo semver patch | ||
1.0.1 | ||
``` | ||
|
||
> **Important**: Running this CLI writes to `Cargo.toml`. Make sure to validate the version before commit. | ||
## Installation | ||
|
||
```console | ||
$ cargo install cargo-semver | ||
``` | ||
|
||
## Usage | ||
|
||
```console | ||
$ cargo semver # gets the current version | ||
$ cargo semver major|minor|patch|pre # bumps the version | ||
$ cargo set [VERSION] # sets a specific version | ||
``` | ||
|
||
### Update version | ||
|
||
You can update the version in your `Cargo.toml` file using one of the subcommands: | ||
|
||
```console | ||
$ cargo semver major | ||
2.0.0 | ||
|
||
$ cargo semver minor | ||
2.1.0 | ||
|
||
$ cargo semver patch | ||
2.1.1 | ||
|
||
$ cargo semver pre alpha | ||
2.1.1-alpha.1 | ||
``` | ||
|
||
If you want to bump the version and add a pre-release version in one command you can use the `pre` flag: | ||
|
||
```console | ||
$ cargo semver major --pre alpha | ||
2.0.0-alpha.1 | ||
``` | ||
|
||
### Updating the pre-release version | ||
|
||
There are multiple ways of updating the pre-release version: | ||
|
||
```console | ||
$ cargo semver major --pre alpha | ||
2.0.0-alpha.1 | ||
|
||
$ cargo semver pre alpha | ||
2.0.0-alpha.2 | ||
|
||
$ cargo semver pre | ||
2.0.0-alpha.3 | ||
|
||
$ cargo semver pre beta | ||
2.0.0-beta.1 | ||
``` | ||
|
||
### Set a specific version | ||
|
||
If you want to set an exact version, use the `set` command: | ||
|
||
```console | ||
$ cargo semver set 2.1.3-beta.3 | ||
2.1.3-beta.3 | ||
``` | ||
|
||
## License | ||
|
||
**cargo-semver** is provided under the MIT License. See LICENSE for details. |