Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Displaying clickable text for showing messages #73

Merged
merged 13 commits into from
Oct 7, 2024
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
Loading