blob: dfe2e9b4a533891030e1572fc8a53f0dc2a08fa2 (
plain)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
# go-bumpver
_Inspired by the python bump2version tool._
bumpver - next semantec version in a given sequence
## Usage
```bash
bumpver part [major|minor|patch] file [-|file] [flags]
```
## Why?
- Most version bumpers are fairly tightly coupled to git.
- Most like to make commits for you
- Few seem to have useful pre release mechanisms
- None seem to provide simple interfaces
- Lack of unix philosophy
Many tools touch git and some opinionatedly like to touch it.
## How?
`go-bumpver` takes the sequence of version(s) from a file or stdin and prints the next version. It drops invalid versions in the sequence and only uses valid ones. It does not make a tag or change any state in git or any other VCS it only prints the next version.
### Inputs
**stdin**
```bash
❯ echo "1.1.1\n1.2.1" | bumpver patch -
1.2.2%
```
**file**
```bash
❯ echo v0.1.0 > VERSION
❯ bumpver patch VERSION
0.1.1%
```
**local repo**
```bash
❯ bumpver patch <(git tag -l)
3.3.2%
```
**remote repo**
```bash
❯ bumpver patch <(git ls-remote --tags --refs origin v\* | awk -F'[ /]' '{ print $NF }')
3.3.4%
```
### Bumps
**a patch**
```bash
❯ bumpver patch <(git tag -l)
3.3.2%
```
**a minor**
```bash
❯ bumpver minor <(git tag -l)
3.4.0%
```
**a major**
```bash
❯ bumpver major <(git tag -l)
4.0.0%
```
|