Skip to content

Commit

Permalink
Factor out add_contributors_one_repo
Browse files Browse the repository at this point in the history
  • Loading branch information
chartgerink committed Jan 30, 2024
1 parent 54d28a7 commit 9acf98f
Showing 1 changed file with 32 additions and 8 deletions.
40 changes: 32 additions & 8 deletions R/add-contributors.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#'
#' Add contributors to README.Rmd
#'
#' @param repo Location of repository for which contributions are to be
#' extracted. This must be a git project with a github remote.
#' @param repo Vector of repository locations for which contributions are to be
#' extracted. Each location must be a git project with a github remote.
#' @param ncols Number of columns for contributors in 'README'
#' @param files Names of files in which to add contributors
#' @param type Type of contributions to include: 'code' for direct code
Expand Down Expand Up @@ -81,7 +81,36 @@ add_contributors <- function (repo = ".",
alphabetical = FALSE,
open_issue = FALSE,
force_update = FALSE) {
ctbs <- add_contributors_one_repo(
repo,
type,
exclude_label,
exclude_issues,
exclude_not_planned,
num_sections,
section_names,
format,
alphabetical
)

chk <- add_contribs_to_files (
ctbs$ctbs, ctbs$or, ncols, format, files,
open_issue, force_update
)

invisible (unlist (chk))
}

add_contributors_one_repo <- function (
repo,
type,
exclude_label,
exclude_issues,
exclude_not_planned,
num_sections,
section_names,
format,
alphabetical) {
if (!in_git_repository (repo)) {
stop ("The path [", repo, "] does not appear to be a git repository")
}
Expand Down Expand Up @@ -136,12 +165,7 @@ add_contributors <- function (repo = ".",

ctbs <- rename_default_sections (ctbs)

chk <- add_contribs_to_files (
ctbs, or, ncols, format, files,
open_issue, force_update
)

invisible (unlist (chk))
return(list(ctbs, or))
}

match_type_arg <- function (type) {
Expand Down

0 comments on commit 9acf98f

Please sign in to comment.