Replaces one or more patterns in a dockerignore object with new patterns.
Details
This function allows you to replace patterns in a dockerignore object. Three modes of operation are supported:
Replace a single pattern with a single pattern
Replace multiple patterns with a single pattern
Replace multiple patterns with corresponding new patterns (one-to-one)
For the third mode, old_pattern
and new_pattern
must have the same length.
See also
di_add()
for adding patterns &
di_remove()
for removing patterns
Other dockerignore instruction functions:
di_add()
,
di_remove()
Examples
# Create a dockerignore object and add some patterns
di <- dockerignore() |>
di_add(c("*.log", "*.tmp", "node_modules/"))
# Replace a single pattern
di <- di_replace(di, "*.log", "logs/")
# Replace multiple patterns with a single pattern
di <- di_replace(di, c("*.tmp", "node_modules/"), "temp/")
# Replace patterns one-to-one
di <- di_replace(di,
c("*.log", "*.tmp"),
c("logs/*", "temp/*"))