Skip to content

GitIgnoreCommand

github-actions edited this page Apr 22, 2026 · 1 revision

Provides functionality to merge and synchronize .gitignore files.

This command merges the canonical .gitignore from dev-tools with the project's existing .gitignore, removing duplicates and sorting entries.

The command accepts two options: --source and --target to specify the paths to the canonical and project .gitignore files respectively.


Constants

Constant Visibility Type Value
FILENAME public string '.gitignore'

Methods

__construct

Creates a new GitIgnoreCommand instance.

public __construct(\FastForward\DevTools\GitIgnore\MergerInterface $merger, \FastForward\DevTools\GitIgnore\ReaderInterface $reader, \FastForward\DevTools\GitIgnore\WriterInterface|null $writer, \Symfony\Component\Config\FileLocatorInterface $fileLocator, \FastForward\DevTools\Resource\FileDiffer $fileDiffer, \Psr\Log\LoggerInterface $logger): mixed

Parameters:

Parameter Type Description
$merger \FastForward\DevTools\GitIgnore\MergerInterface the merger component
$reader \FastForward\DevTools\GitIgnore\ReaderInterface the reader component
$writer \FastForward\DevTools\GitIgnore\WriterInterface|null the writer component
$fileLocator \Symfony\Component\Config\FileLocatorInterface the file locator
$fileDiffer \FastForward\DevTools\Resource\FileDiffer
$logger \Psr\Log\LoggerInterface the output-aware logger

configure

Configures the current command.

protected configure(): void

This method MUST define the name, description, and help text for the command. It SHALL identify the tool as the mechanism for script synchronization.


execute

Executes the gitignore merge process.

protected execute(\Symfony\Component\Console\Input\InputInterface $input, \Symfony\Component\Console\Output\OutputInterface $output): int

Parameters:

Parameter Type Description
$input \Symfony\Component\Console\Input\InputInterface the input interface
$output \Symfony\Component\Console\Output\OutputInterface the output interface

Return Value:

the status code


Inherited methods

addJsonOption

Adds the standard JSON output options to the current command.

protected addJsonOption(): static

isJsonOutput

Determines whether JSON output was requested.

protected isJsonOutput(\Symfony\Component\Console\Input\InputInterface $input): bool

The pretty-json flag SHALL imply JSON output.

Parameters:

Parameter Type Description
$input \Symfony\Component\Console\Input\InputInterface

isPrettyJsonOutput

Determines whether pretty JSON output was requested.

protected isPrettyJsonOutput(\Symfony\Component\Console\Input\InputInterface $input): bool

Parameters:

Parameter Type Description
$input \Symfony\Component\Console\Input\InputInterface

Clone this wiki locally