Skip to content

GitIgnoreCommand

github-actions edited this page Apr 19, 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.


  • Full name: \FastForward\DevTools\Console\Command\GitIgnoreCommand
  • Parent class: BaseCommand
  • This class is marked as final and can't be subclassed
  • This class is a Final class

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): 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

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


Clone this wiki locally