Skip to content

Commit

Permalink
ask the use to confirm their action
Browse files Browse the repository at this point in the history
  • Loading branch information
radbasa committed Aug 27, 2024
1 parent 5b930ae commit a671c2e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Imports:
box,
cli,
fs,
glue,
rlang
Suggests:
languageserver,
Expand Down
10 changes: 10 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@
#'
#' @export
use_box_lsp <- function(file_path = ".Rprofile") {
response <- readline(
glue::glue("Would you like to create or modify the `{file_path}` file? (yes/No) ")
)
response <- substr(response, 1, 1)
if (response == "Y" || response == "y") {
overwrite <- TRUE
} else {
cli::cli_abort("`{file_path}` file creation/modification cancelled!")
}

rprofile <- fs::path_package("box.lsp", "Rprofile.R")
to_write <- readLines(rprofile)

Expand Down

0 comments on commit a671c2e

Please sign in to comment.