Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Depends:
Imports:
backports (>= 0.1.5),
checkmate,
cli,
data.table,
digest,
methods,
Expand All @@ -47,6 +48,7 @@ Collate:
'assert_ro_binding.R'
'calculate_hash.R'
'capitalize.R'
'cat_cli.R'
'catn.R'
'check_operators.R'
'check_packages_installed.R'
Expand Down
4 changes: 4 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export(assert_ro_binding)
export(calculate_hash)
export(call_back)
export(capitalize)
export(cat_cli)
export(catf)
export(catn)
export(check_packages_installed)
Expand Down Expand Up @@ -171,6 +172,9 @@ import(checkmate)
import(data.table)
importFrom(R6,R6Class)
importFrom(R6,is.R6)
importFrom(cli,cli_format_method)
importFrom(cli,cli_h1)
importFrom(cli,cli_li)
importFrom(digest,digest)
importFrom(methods,formalArgs)
importFrom(methods,hasArg)
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

* feat: `as_callbacks()` returns a list named by the callback ids now.
* feat: Added logical operators `%check&&%` and `%check||%` for `check_*`-functions from `checkmate` (moved here from `mlr3pipelines`).
* Added helper `cat_cli()`.

# mlr3misc 0.16.0

Expand Down
18 changes: 18 additions & 0 deletions R/cat_cli.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#' @title Function to transform message to output
#'
#' @description
#' Wrapper around [cli::cli_format_method()].
#' Uses [base::cat()] to transform the printout from a message to an output with a line break.
#'
#' @param expr (`any`)\cr
#' Expression that calls `cli_*` methods, [base::cat()] or[base::print()] to format an object's printout.
#'
#' @export
#' @examples
#' cat_cli({
#' cli::cli_h1("Heading")
#' cli::cli_li(c("x", "y"))
#' })
cat_cli = function(expr) {
cat(cli::cli_format_method(expr), sep = "\n")
}
1 change: 1 addition & 0 deletions R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#' @importFrom digest digest
#' @importFrom methods formalArgs hasArg
#' @importFrom utils capture.output
#' @importFrom cli cli_h1 cli_li cli_format_method
"_PACKAGE"

.onLoad = function(libname, pkgname) {
Expand Down
22 changes: 22 additions & 0 deletions man/cat_cli.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading