Skip to content

Commit

Permalink
Merge pull request #73 from randrescastaneda/new_msg_default
Browse files Browse the repository at this point in the history
Displaying clickable text for showing messages
  • Loading branch information
randrescastaneda authored Oct 7, 2024
2 parents 4a87d0b + 5e9ac95 commit 40359bf
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 2 deletions.
53 changes: 52 additions & 1 deletion R/joyn-merge.R
Original file line number Diff line number Diff line change
Expand Up @@ -539,8 +539,59 @@ joyn <- function(x,

# return messages
joyn_report(verbose = verbose)
if (verbose == TRUE) joyn_msg(msg_type)

if (verbose == TRUE) {

type_element <- rlang::env_get(.joynenv,
"joyn_msgs")$type

warn_count <- fsum(type_element == "warn")

notes_count <- fsum(type_element %in% c("info", "note"))


warning_type <- "warn"
info_type <- "info"
note_type <- "note"

## show messages ------------------

# get output method option
output_method <- getOption("joyn.output_method")

if (output_method == TRUE) {

if (notes_count > 0 || warn_count > 0) {

cli::cli_text("Joyn returned:")

# notes
if (notes_count > 0) {
cli::cli_li(
sprintf(
"{.run [{.strongArg {notes_count} notes}](joyn::joyn_msg('%s'))}
",
info_type
)
)}

# warnings
if (warn_count > 0 ) {
cli::cli_li(
sprintf(
"
{.run [{.strongArg {warn_count} warnings}](joyn::joyn_msg('%s'))}
",
warning_type
)
)}
}

} else {
joyn_msg(msg_type)
}

}
setattr(jn, "class", class_x)

jn
Expand Down
4 changes: 3 additions & 1 deletion R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
joyn.suffixes = c(".x", ".y"),
joyn.match_type = c("1:1", "1:m", "m:1", "m:m"),
joyn.na.last = FALSE,
joyn.msg_type = "basic"
joyn.msg_type = "basic",
joyn.output_method = cli::ansi_has_hyperlink_support()

)
toset <- !(names(op.joyn) %in% names(op))

Expand Down

0 comments on commit 40359bf

Please sign in to comment.