Skip to contents

Pull text files content for a given scope (orgs, repos or whole git hosts).

Usage

get_files_content(
  gitstats_object,
  file_path = NULL,
  use_files_structure = TRUE,
  only_text_files = TRUE,
  cache = TRUE,
  verbose = is_verbose(gitstats_object),
  progress = verbose
)

Arguments

gitstats_object

A GitStats object.

file_path

Optional. A standardized path to file(s) in repositories. May be a character vector if multiple files are to be pulled. If set to NULL and use_files_structure parameter is set to TRUE, GitStats will try to pull data from files_structure (see below).

use_files_structure

Logical. If TRUE and file_path is set to NULL, will iterate over files_structure pulled by get_files_structure() function and kept in storage. If there is no files_structure in storage, an error will be returned. If file_path is defined, it will override use_files_structure parameter.

only_text_files

A logical, TRUE by default. If set to FALSE, apart from files with text content shows in table output also non-text files with NA value for text content.

cache

A logical, if set to TRUE GitStats will retrieve the last result from its storage.

verbose

A logical, TRUE by default. If FALSE messages and printing output is switched off.

progress

A logical, by default set to verbose value. If FALSE no cli progress bar will be displayed.

Value

A data.frame.

Examples

if (FALSE) { # \dontrun{
 my_gitstats <- create_gitstats() %>%
  set_github_host(
    token = Sys.getenv("GITHUB_PAT"),
    orgs = c("r-world-devs")
  ) %>%
  set_gitlab_host(
    token = Sys.getenv("GITLAB_PAT_PUBLIC"),
    orgs = "mbtests"
  )
 get_files_content(
   gitstats_obj = my_gitstats,
   file_path = c("LICENSE", "DESCRIPTION")
 )

 # example with files structure
 files_structure <- get_files_structure(
   gitstats_obj = my_gitstats,
   pattern = "\\.Rmd",
   depth = 2L
 )
 # get_files_content() will make use of pulled earlier files structure
 files_content <- get_files_content(
   gitstats_obj = my_gitstats
 )
} # }