year <- sub("-.*", "", meta$Date)
if (is.null(year) || identical(year, "") || isTRUE(length(year) == 0))
  year <- format(Sys.Date(), "%Y")

ndots <- length(gregexpr(".", meta$Version, fixed = TRUE)[[1]])
if (ndots == 3) {
  cite_url <- "https://github.com/prioritizr/oppr"
} else {
  cite_url <- "https://CRAN.R-project.org/package=oppr"
}

citHeader("To cite the oppr package in publications, please use:")

citEntry(
  entry = "Manual",
  author = personList(
    person(c("Jeffrey", "O"), "Hanson"),
    person(c("Richard"), "Schuster"),
    person(c("Matthew"), "Strimas-Mackey"),
    person(c("Joeseph"), "Bennett")),
  title = "oppr: Optimal Project Prioritization",
  year = year,
  note = paste("R package version", meta$Version),
  url = cite_url,
  textVersion = paste0(
     "Hanson JO, Schuster R, Strimas-Mackey M, Bennett J (", year,
     ") oppr: Optimal Project Prioritization ",
     "R package version ", meta$Version, ". ",
     cite_url
  )
)
