Skip to content

Commit

Permalink
doc
Browse files Browse the repository at this point in the history
  • Loading branch information
stla committed Apr 24, 2024
1 parent 5ceadf4 commit dc812f6
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 12 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Description: Creates a HTML widget which displays the results of searching for a
License: GPL-3
Encoding: UTF-8
SystemRequirements: grep
Imports: htmlwidgets, stringr, crayon, vctrs, tibble, stringi, shiny
Imports: htmlwidgets, stringr, crayon, vctrs, tibble, stringi, shiny, utils
Suggests: shinyAce, shinyWidgets, shinyjqui, shinyFiles, shinyvalidate, fs
URL: https://github.com/stla/findInFiles
BugReports: https://github.com/stla/findInFiles/issues
Expand Down
3 changes: 3 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
export(FIF2dataframe)
export(FIF2tibble)
export(FIFOutput)
export(fif)
export(fifR)
export(findInFiles)
export(renderFIF)
export(shinyFIF)
Expand All @@ -15,5 +17,6 @@ importFrom(shiny,shinyAppDir)
importFrom(stringi,stri_sub_replace_all)
importFrom(stringr,str_split_fixed)
importFrom(tibble,tibble)
importFrom(utils,head)
importFrom(vctrs,new_vctr)
importFrom(vctrs,vec_data)
30 changes: 24 additions & 6 deletions R/findInFiles.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#' Find pattern in files
#' @description Find a pattern in some files.
#' @title Find pattern in files
#' @description Find a pattern in some files. The functions \code{findInFiles}
#' and \code{fif} are the same, and \code{fifR(...)} is the same as
#' \code{findInFiles(ext = "R", ...)}.
#'
#' @name findInFiles
#' @rdname findInFiles
#'
#' @param ext file extension, e.g. \code{"R"} or \code{"js"}
#' @param pattern pattern to search for, a regular expression, e.g.
Expand All @@ -10,11 +15,13 @@
#' directory only, \code{1} to search in the root directory and its
#' subdirectories, etc.
#' @param maxCountPerFile maximum number of results per file, \code{NULL} for
#' an unlimited number, otherwise a positive integer
#' an unlimited number, otherwise a positive integer; when an integer
#' \code{m} is supplied, \code{grep} stops to search in each file after it
#' finds \code{m} results
#' @param maxCount maximum number of results, \code{NULL} for an unlimited
#' number, otherwise a positive integer; supplying an integer does not
#' limit the number of results returned by \code{grep}, it just truncates
#' the output
#' number, otherwise a positive integer; supplying an integer \code{m} just
#' truncates the output, it does not stop \code{grep} after \code{m} results
#' are found (so there is no gain of efficiency)
#' @param wholeWord logical, whether to match the whole pattern
#' @param ignoreCase logical, whether to ignore the case
#' @param perl logical, whether \code{pattern} is a Perl regular expression
Expand All @@ -25,6 +32,7 @@
#' @param root path to the root directory to search from
#' @param output one of \code{"viewer"}, \code{"tibble"} or
#' \code{"viewer+tibble"}; see examples
#' @param ... arguments other than \code{ext} passed to \code{findInFiles}
#'
#' @return A tibble if \code{output="tibble"}, otherwise a
#' \code{htmlwidget} object.
Expand Down Expand Up @@ -157,6 +165,16 @@ findInFiles <- function(

}

#' @rdname findInFiles
#' @export
fif <- findInFiles

#' @rdname findInFiles
#' @export
fifR <- function(...) {
findInFiles(ext = "R", ...)
}

#' @title Output of `findInFiles` as a tibble
#'
#' @description Returns the results of \code{\link{findInFiles}} in a
Expand Down
2 changes: 2 additions & 0 deletions R/grepInFiles.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ getFiles <- function(ext, depth){
Sys.glob(wildcards)
}

#' @importFrom utils head
#' @noRd
grepInFiles <- function(
ext, pattern, depth, maxCountPerFile, maxCount,
wholeWord, ignoreCase, perl,
Expand Down
35 changes: 30 additions & 5 deletions man/findInFiles.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit dc812f6

Please sign in to comment.