Skip to content

Commit

Permalink
Add readme
Browse files Browse the repository at this point in the history
  • Loading branch information
minhqdao committed Mar 2, 2023
1 parent f6ff0a0 commit 0d0cd3a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,14 @@ if (v2 == v4) then ! true

## Increment versions

`Prerelease` and `build` data are cleared each time a major, minor or patch number is incremented. A `prerelease` is incremented by adding `1` to the last identifier if the latter is numeric. If the last identifier isn't a number or no `prerelease` labels exists, a new identifier is added with the value of `1`. Existing `build` information is cleared each time a `prerelease` is incremented.
`Prerelease` and `build` data are cleared each time a major, minor or patch number is incremented. `prerelease` and `build` values are incremented by adding `1` to the their last identifier if it is numeric. If the last identifier isn't a number or no identifiers exist, a new identifier is added with the value of `1`. Existing `build` information is cleared each time a `prerelease` is incremented.

```fortran
type(version_t) :: version
version = version_t(0, 5, 3, 'beta.1', '1')
call version%increment_build() ! 0.5.3-beta.1+2
call version%increment_prerelease() ! 0.5.3-beta.2
call version%increment_patch() ! 0.5.4
call version%increment_minor() ! 0.6.0
Expand Down Expand Up @@ -135,7 +136,7 @@ call v1%increment_prerelease() ! 0.5.4-2

## build metadata

`build` metadata can be included and will be appended after the `patch` or the `prerelease` via a `+` sign. The identifiers must comprise only ASCII alphanumerics and hyphens `[0-9A-Za-z-]` and are separated by dots. Numerical identifiers must not start with a `0` digit. The `build` data is not used for comparison and it is cleared each time the version is incremented.
`build` metadata can be included and will be appended after the `patch` or the `prerelease` via a `+` sign. The identifiers must comprise only ASCII alphanumerics and hyphens `[0-9A-Za-z-]` and are separated by dots. Numerical identifiers must not start with a `0` digit. `build` data is not used for comparison and it is cleared each time a `major`, `minor`, `patch` or `prerelease` version is incremented. A `build` value can be [incremented](#increment-versions).

```fortran
type(version_t) :: v1, v2
Expand All @@ -149,9 +150,11 @@ print *, v2%to_string() ! '0.5.3+abc.1-13'
print *, v1 == v2 ! true
call v1%increment_patch() ! 0.5.4
call v1%increment_build() ! 0.5.4+1
v1 = version_t(0, 5, 3, 'alpha.1' '1')
print *, v1%to_string() ! '0.5.3-alpha.1+1'
print *, v1%increment_build() ! '0.5.3-alpha.1+2'
```

## More examples
Expand Down

0 comments on commit 0d0cd3a

Please sign in to comment.