remove cli

This commit is contained in:
Tom Elliott 2025-01-22 20:58:39 +13:00
parent da186429eb
commit 351e44ee28
4 changed files with 19 additions and 17 deletions

View File

@ -12,7 +12,6 @@ Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.1
Config/testthat/edition: 3
Imports:
cli,
rlang,
Rserve
Suggests:

View File

@ -82,19 +82,18 @@ ts_function <- function(f, ..., result = ts_void()) {
}
#' @export
print.ts_function <- function(x, ...) {
cli::cli_h3("Ocap function")
h3("Ocap function")
cli::cli_text("Arguments:")
cat("Arguments:\n")
args <- lapply(x$args, \(z) z$input_type)
lapply(names(args), \(n) {
cat("- ", n, ": ", args[[n]], "\n", sep = "")
})
cli::cli_text("\n\n")
cat("\n\n")
cli::cli_text("Return type:")
cat("Return type:\n")
cat(x$result$return_type)
}

12
R/helpers.R Normal file
View File

@ -0,0 +1,12 @@
h3 <- function(x) {
cat("\n---", x, "\n")
}
format_js <- function(x) {
if (!requireNamespace("js", quietly = TRUE)) {
return(x)
}
js::uglify_reformat(x, beautify = TRUE)
}

View File

@ -27,21 +27,20 @@ ts_object <- function(input_type = "any",
#' @export
print.ts_object <- function(x, ...) {
# name <- deparse(substitute(x))
cli::cli_ul()
cli::cli_h3("Input type: ")
h3("Input type: ")
if (nchar(x$input_type) > 50) {
cat(format_js(x$input_type), "\n")
} else {
cat(x$input_type, "\n")
}
cli::cli_h3("Return type: ")
h3("Return type: ")
if (nchar(x$return_type) > 50) {
print(x$return_type)
cat(format_js(x$return_type), "\n")
} else {
cat(x$return_type, "\n")
}
cli::cli_end()
cat("\n")
}
#' @describeIn ts_object Check if an object is a ts object
@ -397,10 +396,3 @@ ts_void <- function() {
}
)
}
format_js <- function(x) {
if (!requireNamespace("js", quietly = TRUE)) {
return(x)
}
js::uglify_reformat(x, beautify = TRUE)
}