Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

include some globbing helper #167

Closed
jmbarbone opened this issue Dec 13, 2022 · 0 comments · Fixed by #202
Closed

include some globbing helper #167

jmbarbone opened this issue Dec 13, 2022 · 0 comments · Fixed by #202
Labels
new feature 🎁 New feature request
Milestone

Comments

@jmbarbone
Copy link
Owner

something like what's implemented in fs::dir_ls()

glob <- function(x, glob = NULL, regexp = NULL, invert = FALSE, ...) {
  if (!is.null(glob)) {
    if (!is.null(regexp)) {
      stop("either `glob` or `regexp` should be NULL", call. = FALSE)
    }
    regexp <- utils::glob2rx(glob)
  }

  if (!is.null(regexp)) {
    params <- list(...)
    params$pattern <- regexp
    params$x <- x
    params$value <- TRUE
    params$invert <- isTRUE(invert)
    x <- do.call(grep, params)
  }

  x
}
@jmbarbone jmbarbone added the new feature 🎁 New feature request label Dec 13, 2022
@jmbarbone jmbarbone added this to the 0.6.1 milestone Mar 16, 2023
@jmbarbone jmbarbone modified the milestones: 0.6.1, 0.7.0 May 4, 2023
@jmbarbone jmbarbone mentioned this issue Aug 11, 2023
jmbarbone added a commit that referenced this issue Aug 12, 2023
jmbarbone added a commit that referenced this issue Aug 12, 2023
jmbarbone added a commit that referenced this issue Aug 12, 2023
jmbarbone added a commit that referenced this issue Aug 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature 🎁 New feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant