-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtoolkit.nu
More file actions
39 lines (37 loc) · 1.72 KB
/
Copy pathtoolkit.nu
File metadata and controls
39 lines (37 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Release a new version based on package version in Cargo.toml
@example "release new version based on Cargo.toml" { release }
export def release [] {
let version = open Cargo.toml | get package.version
let confirm = input ($"> Package version is ($version). Create new tag for this version and push to GitHub? \(y/n\) ")
if (($confirm | str downcase) == 'y') {
git tag $"v($version)"
git push origin $"v($version)"
} else {
print "Cancelled tagged release."
}
}
# Bump the package's minor version
@example "specify a new version" { bump-cargo-version 1.0.0 } --result $"Quiver updated from (ansi yellow)0.3.4(ansi reset) to (ansi green)1.0.0"
@example "bump the minor version" { bump-cargo-version } --result $"Quiver updated from (ansi yellow)0.3.4(ansi reset) to (ansi green)0.4.0"
export def bump-cargo-version [
version?: string
--major (-M) # bump the major version
--minor (-m) # bump the minor version (default)
--patch (-p) # bump the patch version
] {
mut new_version = open Cargo.toml | get package.version | into semver
if $version != null {
$new_version = $version | into semver
} else if $major {
$new_version = $new_version | semver bump major
} else if $patch {
$new_version = $new_version | semver bump patch
} else {
$new_version = $new_version | semver bump minor
}
let current_version = open Cargo.toml | get package.version
open Cargo.toml | update package.version ($new_version | into string) | collect | save -f Cargo.toml
print $"Quiver updated from (ansi yellow)($current_version)(ansi reset) to (ansi green)($new_version)"
}
# Alias to bump package's minor version
export alias bcv = bump-cargo-version