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

Correct function name from my_fun_opts() to my_fun() #185

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions argument-clutter.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ This then allows you to create more informative error messages:
```{r}
#| error: true

my_fun_opts <- function(..., opts = my_fun_opts()) {
my_fun <- function(..., opts = my_fun_opts()) {
if (!inherits(opts, "mypackage_my_fun_opts")) {
cli::cli_abort("{.arg opts} must be created by {.fun my_fun_opts}.")
}
}

my_fun_opts(opts = 1)
my_fun(opts = 1)
```

If you use this option in many places, you should consider pulling out the repeated code into a `check_my_fun_opts()` function.
Expand Down
Loading