diff --git a/NAMESPACE b/NAMESPACE index 14abdd3..629a0ad 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,5 +1,6 @@ # Generated by roxygen2: do not edit by hand export(fun) -export(informant) export(pkg) +importFrom(utils,capture.output) +importFrom(utils,ls.str) diff --git a/R/peek.R b/R/peek.R index 9a03417..8d050ce 100644 --- a/R/peek.R +++ b/R/peek.R @@ -1,7 +1,6 @@ - -#' @export +#' @importFrom utils ls.str capture.output informant <- function() { - hex_pink <- cli::make_ansi_style("pink")("⬢") + hex_pink <- cli::make_ansi_style("pink")("\U2B22") env <- parent.frame() calls <- sys.calls() @@ -22,21 +21,24 @@ informant <- function() { #' Peek function inputs #' +#' @param what Function to snitch on +#' #' @examples #' fun(rnorm) #' #' @export -fun <- function(fun, tracer = snitch::informant, where = topenv(parent.frame())) { +fun <- function(what) { call <- sys.call() call[[1L]] <- quote(trace) - call$where <- where - call$tracer <- tracer + call$where <- topenv(parent.frame()) + call$tracer <- informant eval.parent(call) } #' Peek all functions from a package #' #' @param pkg The package to snitch on +#' @param pattern filter functions #' #' @examples #' pkg("dplyr") diff --git a/man/fun.Rd b/man/fun.Rd index 4cb4bdb..a893fe2 100644 --- a/man/fun.Rd +++ b/man/fun.Rd @@ -4,7 +4,10 @@ \alias{fun} \title{Peek function inputs} \usage{ -fun(fun, tracer = snitch::informant, where = topenv(parent.frame())) +fun(what) +} +\arguments{ +\item{what}{Function to snitch on} } \description{ Peek function inputs diff --git a/man/pkg.Rd b/man/pkg.Rd index 79fda32..6f18fc2 100644 --- a/man/pkg.Rd +++ b/man/pkg.Rd @@ -8,6 +8,8 @@ pkg(pkg, pattern = "") } \arguments{ \item{pkg}{The package to snitch on} + +\item{pattern}{filter functions} } \description{ Peek all functions from a package