sniff_one: scan one secret string across many paths

View source: R/snif_one.R

sniff_oneR Documentation

scan one secret string across many paths

Description

scan one secret string across many paths

Usage

sniff_one(path, secret_string)

Arguments

path

(character) path to fixtures directory. required

secret_string

(character) a character string to look for. required

Value

a named list, with vector of line numbers for where string found; if none found an empty list

Examples

## Not run: 
Sys.setenv(A_KEY = "a8d#d%d7g7g4012a4s2")
path <- file.path(tempdir(), "foobar")
dir.create(path)
# no matches
sniff_one(path, Sys.getenv("A_KEY"))
# add files with the secret
cat(paste0("foo\nbar\nhello\nworld\n", 
  Sys.getenv("A_KEY"), "\n"), file = file.path(path, "stuff.R"))
# matches!
sniff_one(path, Sys.getenv("A_KEY"))

## End(Not run)

ropenscilabs/trufflesniffer documentation built on Sept. 12, 2022, 11:13 p.m.