remove cli
This commit is contained in:
parent
da186429eb
commit
351e44ee28
@ -12,7 +12,6 @@ Roxygen: list(markdown = TRUE)
|
||||
RoxygenNote: 7.3.1
|
||||
Config/testthat/edition: 3
|
||||
Imports:
|
||||
cli,
|
||||
rlang,
|
||||
Rserve
|
||||
Suggests:
|
||||
|
||||
@ -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
12
R/helpers.R
Normal 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)
|
||||
}
|
||||
14
R/types.R
14
R/types.R
@ -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)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user