Skip to content

Commit

Permalink
change cat() to cli_inform() to return printed text as message, a…
Browse files Browse the repository at this point in the history
…ddresses #32
  • Loading branch information
karishmas26 committed May 6, 2024
1 parent 8e4c32e commit e733cbc
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions R/fetch_indicators.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ fetch_indicators <- function(df, tab = "main") {
pd <- df %>%
gophr::identifypd() %>%
stringr::str_extract(".{2}$")
cat("Fetching ", crayon::yellow(pd), " indicators\n")

#cat("Fetching ", crayon::yellow(pd), " indicators\n")
cli::cli_inform(glue::glue("Fetching {crayon::yellow(pd)} indicators\n"))

if(!tab %in% c("main", "treatment")) {
stop("Please select the indicator crosswalk you would like to use: main or treatment")
Expand All @@ -41,7 +43,10 @@ fetch_indicators <- function(df, tab = "main") {
} else {
indics <- indic_list
}
cat(crayon::yellow(pd), " indicators fetched ", crayon::yellow(indics$indicator), "\n")

#concatenate indicator list into a chracter for return message
lst <- paste(indics$indicator, collapse = ", ")
cli::cli_inform(glue::glue("{crayon::yellow(pd)} indicators fetched {crayon::yellow(lst)} \n"))

return(indics)
}

0 comments on commit e733cbc

Please sign in to comment.