set_version {semver} | R Documentation |
Set version field
Description
Set the version field. "Major", "minor" and "patch" fields are set as integers, "prerelease" and "build" are set with character strings.
Usage
set_version(x, field, value, ...)
## S3 method for class 'svptr'
set_version(x, field = c("major", "minor", "patch",
"prerelease", "build"), value, ...)
## S3 method for class 'svlist'
set_version(x, field, value, ...)
Arguments
x |
An object of class "svlist" or "svptr". |
field |
For the "svptr" class a character string detailing the field to set (major, minor etc...). For the "svlist" class a character vector detailing the field to set for each list member. |
value |
The value to set the field to. For fields "major", "minor" and "patch" this is an integer. For fields "prerelease" and "build" this is a character. For the "svptr" class value is a scalar. For the "svlist" class value is a list detailing the value to set for each list member. |
... |
Additional arguments passed on to methods. |
Value
returns an object of class svptr or svlist
Examples
semver <- parse_version(c("1.2.3", "1.2.4-alpha+bld1"))
semver[[1]] <- set_version(semver[[1]], "major", 2L)
set_version(semver, c("prerelease", "build"), list("hello"))
set_version(semver, c("prerelease"), list("hello", "world"))
[Package semver version 0.2.0 Index]