wflow_remove: Remove files

View source: R/wflow_remove.R

wflow_removeR Documentation

Remove files

Description

wflow_remove removes files. If the file to be removed is an R Markdown file, the corresponding HTML and other related files are also removed. If the workflowr project uses Git, wflow_remove commits the changes.

Usage

wflow_remove(files, message = NULL, git = TRUE, dry_run = FALSE, project = ".")

Arguments

files

character. Files to be removed. Supports file globbing.

message

character (default: NULL). A commit message.

git

logical (default: TRUE). Commit the changes (only applicable if Git repository is present).

dry_run

logical (default: FALSE). Preview the files to be removed but do not actually remove them.

project

character (default: ".") By default the function assumes the current working directory is within the project. If this is not true, you'll need to provide the path to the project directory.

Value

An object of class wflow_remove, which is a list with the following elements:

  • files: The relative path(s) to the removed file(s).

  • message: The message describing the commit (if applicable).

  • dry_run: The input argument dry_run.

  • commit:The object returned by git2r::commit (only included if dry_run == FALSE).

  • files_git: The relative path(s) to the file(s) removed from the Git repository.

See Also

wflow_git_commit

Examples

## Not run: 

# Remove a single file
wflow_remove("analysis/file.Rmd", "Remove old analysis.")
# Remove multiple files
wflow_remove(c("analysis/file.Rmd", "output/small-data.txt"),
             "Remove old analysis and its associated data.")

## End(Not run)


jdblischak/workflowr documentation built on Nov. 26, 2024, 5:14 p.m.