Skip to content

Latest commit

 

History

History
103 lines (65 loc) · 1.74 KB

git_attribute_command.md

File metadata and controls

103 lines (65 loc) · 1.74 KB

Git Attributes

Use the interface: ArtARTs36\GitHandler\Contracts\Commands\GitAttributeCommand


Create Instance

use \ArtARTs36\GitHandler\Factory\LocalGitFactory;

$command = (new LocalGitFactory())->factory(__DIR__)->attributes();

Features:

* Add git attribute

Method Signature:

public function add(string $pattern, array $attributes): void;

Example:

use \ArtARTs36\GitHandler\Factory\LocalGitFactory;

(new LocalGitFactory())->factory(__DIR__)->attributes()->add('pattern-test', ['export-ignore']);

* Find git attribute by pattern

Method Signature:

public function find(string $pattern): ?ArtARTs36\GitHandler\Data\GitAttributes;

Example:

use \ArtARTs36\GitHandler\Factory\LocalGitFactory;

(new LocalGitFactory())->factory(__DIR__)->attributes()->find('pattern-test');

* Delete git attribute by pattern

Method Signature:

public function delete(string $pattern): bool;

Example:

use \ArtARTs36\GitHandler\Factory\LocalGitFactory;

(new LocalGitFactory())->factory(__DIR__)->attributes()->delete('pattern-test');

* Switch folder to root (project dir)

Method Signature:

public function seeToRoot(): static;

Example:

use \ArtARTs36\GitHandler\Factory\LocalGitFactory;

(new LocalGitFactory())->factory(__DIR__)->attributes()->seeToRoot();

* Switch folder

Method Signature:

public function seeToFolder(string $folder): static;

Example:

use \ArtARTs36\GitHandler\Factory\LocalGitFactory;

(new LocalGitFactory())->factory(__DIR__)->attributes()->seeToFolder('folder-test');