-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixes #172
- Loading branch information
Showing
5 changed files
with
38 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
check_extension_approval <- function(no_prompt = FALSE, what = "Something", see_more_at = NULL) { | ||
if (!no_prompt) { | ||
if (!rlang::is_interactive()) { | ||
cli::cli_abort(c( | ||
"{ what } requires explicit approval.", | ||
">" = "Set {.arg no_prompt = TRUE} if you agree.", | ||
if (!is.null(see_more_at)) { | ||
c(i = "See more at {.url {see_more_at}}") | ||
} | ||
)) | ||
} else { | ||
cli::cli_inform(c( | ||
"{what} may execute code when documents are rendered. ", | ||
"*" = "If you do not trust the author(s) of this {what}, we recommend that you do not install or use this {what}." | ||
)) | ||
prompt_value <- tolower(readline(sprintf("Do you trust the authors of this %s (Y/n)? ", what))) | ||
if (!prompt_value %in% "y") { | ||
cli::cli_inform("{what} not installed.") | ||
return(invisible(FALSE)) | ||
if (no_prompt) return(TRUE) | ||
|
||
if (!rlang::is_interactive()) { | ||
cli::cli_abort(c( | ||
"{ what } requires explicit approval.", | ||
">" = "Set {.arg no_prompt = TRUE} if you agree.", | ||
if (!is.null(see_more_at)) { | ||
c(i = "See more at {.url {see_more_at}}") | ||
} | ||
)) | ||
} else { | ||
cli::cli_inform(c( | ||
"{what} may execute code when documents are rendered. ", | ||
"*" = "If you do not trust the author(s) of this {what}, we recommend that you do not install or use this {what}." | ||
)) | ||
prompt_value <- tolower(readline(sprintf("Do you trust the authors of this %s (Y/n)? ", what))) | ||
if (!prompt_value %in% "y") { | ||
cli::cli_inform("{what} not installed.") | ||
return(invisible(FALSE)) | ||
} | ||
} | ||
} |