Skip to content

Commit

Permalink
implement pal_remove()
Browse files Browse the repository at this point in the history
  • Loading branch information
simonpcouch committed Oct 10, 2024
1 parent f5a7b1c commit f312254
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
12 changes: 10 additions & 2 deletions R/pal-add-remove.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#' `NULL`, invisibly. Called for its side effect: a pal with role `role`
#' is registered with the pal package.
#'
#' @name pal_add_remove
#' @export
pal_add <- function(
role,
Expand All @@ -43,9 +44,16 @@ pal_add <- function(
invisible()
}

# TODO: fn to remove the addin associated with the role
#' @rdname pal_add_remove
pal_remove <- function(role) {
invisible()
if (!role %in% list_pals()) {
cli::cli_abort("No active pal with the given {.arg role}.")
}

env_unbind(
pal_env(),
c(paste0("system_prompt_", role), paste0("rs_pal_", role))
)
}

supported_interfaces <- c("replace", "prefix", "suffix")
Expand Down
24 changes: 8 additions & 16 deletions man/pal_add.Rd → man/pal_add_remove.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f312254

Please sign in to comment.