Skip to content

Commit

Permalink
Use cli instead of crayon
Browse files Browse the repository at this point in the history
  • Loading branch information
markfairbanks committed Feb 28, 2023
1 parent 8f71a20 commit a085b98
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
1 change: 0 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ Depends:
R (>= 3.3)
Imports:
cli (>= 3.4.0),
crayon,
data.table (>= 1.13.0),
dplyr (>= 1.1.0),
glue,
Expand Down
10 changes: 5 additions & 5 deletions R/step.R
Original file line number Diff line number Diff line change
Expand Up @@ -179,23 +179,23 @@ pull.dtplyr_step <- function(.data, var = -1, name = NULL) {
print.dtplyr_step <- function(x, ...) {
dt <- as.data.table(x)

cat_line(crayon::bold("Source: "), "local data table ", dplyr::dim_desc(dt))
cat_line(cli::style_bold("Source: "), "local data table ", dplyr::dim_desc(dt))
if (length(x$groups) > 0) {
cat_line(crayon::bold("Groups: "), paste(x$groups, collapse = ", "))
cat_line(cli::style_bold("Groups: "), paste(x$groups, collapse = ", "))
}
if (length(x$locals) > 0) {
cat_line(crayon::bold("Call:"))
cat_line(cli::style_bold("Call:"))
for (var in names(x$locals)) {
cat_line(" ", var, " <- ", expr_deparse(x$locals[[var]]))
}
cat_line(" ", expr_text(dt_call(x)))
} else {
cat_line(crayon::bold("Call: "), expr_text(dt_call(x)))
cat_line(cli::style_bold("Call: "), expr_text(dt_call(x)))
}
cat_line()
cat_line(format(as_tibble(dt, .name_repair = "minimal"), n = 6)[-1]) # Hack to remove "A tibble" line
cat_line()
cat_line(crayon::silver(
cat_line(cli::col_silver(
"# Use as.data.table()/as.data.frame()/as_tibble() to access results"
))

Expand Down

0 comments on commit a085b98

Please sign in to comment.