Package 'gitignore'

Title: Create Useful .gitignore Files for your Project
Description: Simple interface to query gitignore.io to fetch gitignore templates that can be included in the .gitignore file. More than 450 templates are currently available.
Authors: Philippe Massicotte [aut, cre] , Amanda Dobbyn [rev], Mauro Lepore [rev]
Maintainer: Philippe Massicotte <[email protected]>
License: GPL-3
Version: 0.1.8.9000
Built: 2024-12-01 07:43:03 UTC
Source: https://github.com/ropensci/gitignore

Help Index


Fetch available templates from gitignore.io

Description

This return list of all templates supported by gitignore.io.

Usage

gi_available_templates()

Details

The returned list is returned as lower case characters.

Value

A character with all templates supported by gitignore.io.

Examples

gi_available_templates()

Fetch gitignore template(s) from gitignore.io

Description

Fetch gitignore template(s) from gitignore.io

Usage

gi_fetch_templates(
  template_name,
  copy_to_clipboard = FALSE,
  append_gitignore = FALSE,
  gitignore_file = here::here(".gitignore")
)

Arguments

template_name

A character vector with values included in gi_available_templates.

copy_to_clipboard

Logical. Should the returned template(s) be copied to the clipboard? Otherwise, it will be printed in the console. Default is FALSE.

append_gitignore

Logical. Should the .gitignore be modified to include the returned template(s)?

gitignore_file

The path of the .gitignore file to be modified. By default, it will try to find it in the current package/project using 'here::here(".gitignore")'.

Value

A character containing gitignore template(s).

Examples

# Fetch template for the R language
gi_fetch_templates("R")

# You can combine many templates at once
gi_fetch_templates(c("R", "python", "java"))

# The .gitignore file can be automatically modified with `append_gitignore = TRUE`
gi_fetch_templates(c("R", "python", "java"))

Append or create a .gitignore file

Description

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

Usage

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

## Not run: 
f <- file.path(tempdir(), ".gitignore")
new_lines <- gi_fetch_templates("r")
gi_write_gitignore(new_lines, f)

unlink(f)

## End(Not run)