Skip to content

Conversation

@simonpcouch
Copy link
Contributor

cli_inform() handles nested {} a bit differently than cli_warn() and cli_abort().

library(cli)

exclamation <- "Darn!"
msg <- c("!" = "That didn't work. {{exclamation}}")

cli_inform(msg)
#> ! That didn't work. Darn!
cli_warn(msg)
#> Warning: ! That didn't work. {exclamation}
cli_abort(msg)
#> Error:
#> ! That didn't work. {exclamation}

prompt_missing_implementation() made use of that off-label behavior in cli_inform(), and this caused some wonkiness when called with the warn or abort prompts and a non-missing engine:

library(parsnip)

# ope -- note "using the `{engine}` engine."
cubist_rules(engine = "Cubist") %>% fit(mpg ~., data = mtcars)
#> Error in `fit()`:
#> ! parsnip could not locate an implementation for `cubist_rules` model
#>   specifications using the `{engine}` engine.
#> ℹ The parsnip extension package rules implements support for this
#>   specification.
#> ℹ Please install (if needed) and load to continue.

Created on 2022-09-08 by the reprex package (v2.0.1)

With this PR:

library(parsnip)

cubist_rules(engine = "Cubist") %>% fit(mpg ~., data = mtcars)
#> Error in `fit()`:
#> ! parsnip could not locate an implementation for `cubist_rules` model
#>   specifications using the `Cubist` engine.
#> ℹ The parsnip extension package rules implements support for this
#>   specification.
#> ℹ Please install (if needed) and load to continue.

cubist_rules(engine = "Cubist")
#> ! parsnip could not locate an implementation for `cubist_rules` model
#>   specifications using the `Cubist` engine.
#> ℹ The parsnip extension package rules implements support for this
#>   specification.
#> ℹ Please install (if needed) and load to continue.
#> Cubist Model Specification (regression)
#> 
#> Computational engine: Cubist

Created on 2022-09-08 by the reprex package (v2.0.1)

@topepo topepo merged commit de7071e into main Sep 15, 2022
@github-actions
Copy link
Contributor

This pull request has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.

@github-actions github-actions bot locked and limited conversation to collaborators Sep 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants