Use the returned template(s) to append the existing .gitignore file.

gi_write_gitignore(fetched_template, gitignore_file = here::here(".gitignore"))

Arguments

fetched_template

Template(s) returned by `gi_fetch_templates()`.

gitignore_file

Path of the .gitignore file to modify.

Value

TRUE if succeeds to write/append the .gitignore, FALSE otherwise.

Examples

# \donttest{ f <- file.path(tempdir(), ".gitignore") new_lines <- gi_fetch_templates("r")
#> #> # Created by https://www.toptal.com/developers/gitignore/api/r #> # Edit at https://www.toptal.com/developers/gitignore?templates=r #> #> ### R ### #> # History files #> .Rhistory #> .Rapp.history #> #> # Session Data files #> .RData #> #> # User-specific files #> .Ruserdata #> #> # Example code in package build process #> *-Ex.R #> #> # Output files from R CMD build #> /*.tar.gz #> #> # Output files from R CMD check #> /*.Rcheck/ #> #> # RStudio files #> .Rproj.user/ #> #> # produced vignettes #> vignettes/*.html #> vignettes/*.pdf #> #> # OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3 #> .httr-oauth #> #> # knitr and R markdown default cache directories #> *_cache/ #> /cache/ #> #> # Temporary files created by R markdown #> *.utf8.md #> *.knit.md #> #> # R Environment Variables #> .Renviron #> #> ### R.Bookdown Stack ### #> # R package: bookdown caching files #> /*_files/ #> #> # End of https://www.toptal.com/developers/gitignore/api/r
gi_write_gitignore(new_lines, f)
#> ● The .gitignore file could not be found in the project directory/data/docs/gitignore_TMP/referenceWould you like to create it?
#> Error in utils::menu(c("Yes", "No")): menu() cannot be used non-interactively
unlink(f) # }