% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ru_setup.R
\name{parse_odkc_version}
\alias{parse_odkc_version}
\title{Parse a given ODK Central version string or number into a \code{semver}.}
\usage{
parse_odkc_version(v, env_var = "ODKC_VERSION")
}
\arguments{
\item{v}{A string (e.g. "ODKC_VERSION=") or number (e.g. 0.8, 1.5) of a
complete or partial semver, or a semver of class "svlist".}

\item{env_var}{A string indicating which environment variable was targeted.
This is used in the warning to advise which environment variable to update.
If set to an empty string, the warning message is suppressed.
Default: "ODKC_VERSION".}
}
\value{
semver::svlist The version as semver of major, minor, and patch.
}
\description{
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}}
}
\details{
Past versions of ruODK advised to set ODKC_VERSION to a floating point number
indicating major and minor versions, e.g. \code{ODKC_VERSION=0.7} or
\code{ODKC_VERSION=1.5}.

ODK Central has since switched to semantic versioning, e.g.
\verb{ODKC_VERSION=ODKC_VERSION=}.

To preserve backwards compatibility, ruODK handles both formats gracefully,
but emits a helpful warning to update the version string if the older format
is detected, or the version string is missing the minor or patch version.
}
\examples{
parse_odkc_version("1.2.3")

# Warn: too short
parse_odkc_version("1")
parse_odkc_version("1.2")

# Warn: too long
parse_odkc_version("1.2.3.4")

# Warn: otherwise invalid
parse_odkc_version("1.2.")
parse_odkc_version(".2.3")

}
\seealso{
Other ru_settings: 
\code{\link{odata_svc_parse}()},
\code{\link{ru_settings}()},
\code{\link{ru_setup}()},
\code{\link{semver_gt}()},
\code{\link{semver_lt}()},
\code{\link{yell_if_error}()},
\code{\link{yell_if_missing}()}
}
\concept{ru_settings}
