Skip to content

Commit

Permalink
polish breadcrumbs closes #1
Browse files Browse the repository at this point in the history
  • Loading branch information
romainfrancois committed Feb 7, 2024
1 parent 8e1ab69 commit 7856df5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ URL: https://github.com/tadascience/snitch, http://tada.science/snitch/
BugReports: https://github.com/tadascience/snitch/issues
Imports:
cli,
glue,
rlang,
stringr
8 changes: 7 additions & 1 deletion R/peek.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ breadcrumbs <- function() {
snitched <- sapply(frames, function(f) exists(".__snitch", f, inherits = FALSE))

crumbs <- sapply(calls[snitched], function(call) {
as.character(call[[1L]])
if (rlang::is_call(call[[1L]], "::")) {
glue::glue("{pkg}::{fun}", pkg = call[[1L]][[2L]], fun = call[[1L]][[3L]])
} else if (rlang::is_call(call[[1L]], ":::")) {
glue::glue("{pkg}:::{fun}", pkg = call[[1L]][[2L]], fun = call[[1L]][[3L]])
} else {
as.character(call[[1L]])
}
})

# TODO: figure out why eval is in there in the first place
Expand Down

0 comments on commit 7856df5

Please sign in to comment.