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
anduse_files_structure
parameter is set toTRUE
,GitStats
will try to pull data fromfiles_structure
(see below).- use_files_structure
Logical. If
TRUE
andfile_path
is set toNULL
, will iterate overfiles_structure
pulled byget_files_structure()
function and kept in storage. If there is nofiles_structure
in storage, an error will be returned. Iffile_path
is defined, it will overrideuse_files_structure
parameter.- only_text_files
A logical,
TRUE
by default. If set toFALSE
, apart from files with text content shows in table output also non-text files withNA
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. IfFALSE
messages and printing output is switched off.- progress
A logical, by default set to
verbose
value. IfFALSE
nocli
progress bar will be displayed.
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
)
} # }