We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
See the following reprex:
library(cli) pluralize('{c(NA_character_)} file{?s}') #> NA file pluralize('{c("file1", NA_character_)} file{?s}') #> NA files pluralize('{c(NA_character_, "file1")} file{?s}') #> NA files pluralize('{c("file1", "file2", NA_character_)} file{?s}') #> NA files
Created on 2024-08-15 with reprex v2.1.1
I believe the expected behavior should be to have the vector displayed as is with the included NAs.
NA
The text was updated successfully, but these errors were encountered:
Seems like this is expected behavior, the underlying cause appears to be in
cli/R/glue.R
Lines 152 to 163 in 2ddcc1a
Seems undesirable to me, but maybe this behavior is necessary elsewhere outside of pluralize().
pluralize()
Sorry, something went wrong.
If the "pluralizing quantity" is a character vector, then the length of the vector is used. E.g. to be able to write:
fs <- c("foo", "bar") cli_text('Reading file{?s}: {fs}') #> Reading files: foo and bar
It does not matter if the character vector contains NA elements or not:
v <- c(NA_character_, "bar") cli_text("Got element{?s}: {v}.") #> Got elements: NA and bar.
The difference seems to be between pluralize() and cli_text() the latter is doing the correct processing while the former is collapsing to just NA.
cli_text()
No branches or pull requests
See the following reprex:
Created on 2024-08-15 with reprex v2.1.1
I believe the expected behavior should be to have the vector displayed as is with the included
NA
s.The text was updated successfully, but these errors were encountered: