Skip to content
New issue

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

consider verbose() #29

Closed
jmbarbone opened this issue Jun 9, 2023 · 0 comments · Fixed by #30
Closed

consider verbose() #29

jmbarbone opened this issue Jun 9, 2023 · 0 comments · Fixed by #30
Assignees
Labels
enhancement New feature or request

Comments

@jmbarbone
Copy link
Owner

utility for including easy verbosity

verbose <- function(...) {
  if (getOption("verbose")) {
    if (!(is.null(..1) && ...length() == 1L)) {
      message(...)
    }
  }

  invisible()
}
options(verbose = FALSE)
# does nothing
verbose("anything here")

options(verbose = TRUE)
# when ... is NULL, nothing will happen
verbose(NULL)

# prints as a message
verbose("hello")
#> hello

# will register as `NULL` but will still write to stdout
verbose(writeLines("one", "two"))
#> one
#> two
@jmbarbone jmbarbone added the enhancement New feature or request label Jun 9, 2023
@jmbarbone jmbarbone self-assigned this Jun 9, 2023
jmbarbone added a commit that referenced this issue Jul 5, 2023
jmbarbone added a commit that referenced this issue Jul 5, 2023
jmbarbone added a commit that referenced this issue Jul 5, 2023
jmbarbone added a commit that referenced this issue Jul 5, 2023
jmbarbone added a commit that referenced this issue Jul 5, 2023
@jmbarbone jmbarbone mentioned this issue Jul 5, 2023
jmbarbone added a commit that referenced this issue Jul 21, 2023
jmbarbone added a commit that referenced this issue Jul 21, 2023
jmbarbone added a commit that referenced this issue Jul 21, 2023
jmbarbone added a commit that referenced this issue Jul 21, 2023
jmbarbone added a commit that referenced this issue Jul 21, 2023
jmbarbone added a commit that referenced this issue Jul 21, 2023
jmbarbone added a commit that referenced this issue Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant