Skip to content

Commit

Permalink
refactor: rm the open_or_go_to arg from file_created_dance
Browse files Browse the repository at this point in the history
  • Loading branch information
ColinFay committed Aug 27, 2024
1 parent 598fc7f commit 0480655
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 14 deletions.
13 changes: 4 additions & 9 deletions R/after_creation_msg.R
Original file line number Diff line number Diff line change
Expand Up @@ -123,21 +123,16 @@ file_created_dance <- function(
dir,
name,
open_file,
open_or_go_to = TRUE,
catfun = cat_created
) {
catfun(where)

fun(pkg, dir, basename(where))

if (open_or_go_to) {
open_or_go_to(
where = where,
open_file = open_file
)
} else {
return(invisible(where))
}
open_or_go_to(
where = where,
open_file = open_file
)
}

file_already_there_dance <- function(
Expand Down
1 change: 0 additions & 1 deletion R/use_files_external_tools.R
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ perform_checks_and_download_if_everything_is_ok <- function(
pkg = pkg,
dir = directory_to_download_to,
open_file = open,
open_or_go_to = FALSE,
catfun = cat_downloaded
)
}
1 change: 0 additions & 1 deletion R/use_files_internal_tools.R
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ perform_checks_and_copy_if_everything_is_ok <- function(
pkg = pkg,
dir = directory_to_copy_to,
open_file = open,
open_or_go_to = FALSE,
catfun = cat_copied
)
}
3 changes: 2 additions & 1 deletion tests/testthat/_snaps/after_creation_msg.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@
File downloaded at inst/app/www/myhtml
Code
file_created_dance("inst/app/www", after_creation_message_sass, "mypkg",
"inst/app/www", "mysass", open_file = FALSE, open_or_go_to = FALSE)
"inst/app/www", "mysass", open_file = FALSE)
Output
v File created at inst/app/www
* Go to inst/app/www
Code
file_already_there_dance("inst/app/www", open_file = FALSE)
Output
Expand Down
3 changes: 1 addition & 2 deletions tests/testthat/test-after_creation_msg.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ test_that("after_creation_msg works", {
"mypkg",
"inst/app/www",
"mysass",
open_file = FALSE,
open_or_go_to = FALSE
open_file = FALSE
)
file_already_there_dance(
"inst/app/www",
Expand Down

0 comments on commit 0480655

Please sign in to comment.