-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstb.php
40 lines (35 loc) · 1.36 KB
/
stb.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
use shakethatbranch\commands\AddChildCommand;
use shakethatbranch\commands\CreateChildCommand;
use shakethatbranch\commands\InitCommand;
use shakethatbranch\commands\ListChildrenCommand;
use shakethatbranch\commands\MergeIntoChildrenCommand;
use shakethatbranch\commands\PushCommand;
use shakethatbranch\commands\RemoveChildCommand;
use shakethatbranch\exceptions\GitRepositoryNotInitializedException;
use shakethatbranch\repositories\ChildRepository;
use shakethatbranch\system\GitRepository;
use Symfony\Component\Console\Application;
require_once __DIR__.'/vendor/autoload.php';
$gitRepository = new GitRepository(getcwd());
try {
$gitRepository->getRepositoryRoot();
}
catch (GitRepositoryNotInitializedException $e) {
echo 'Git repository not initialized, please run `git init`'.PHP_EOL;
exit(1);
}
$childRepository = new ChildRepository($gitRepository->getRepositoryRoot());
$application = new Application();
$application->addCommands(
[
new InitCommand($gitRepository, $childRepository),
new AddChildCommand($gitRepository, $childRepository),
new CreateChildCommand($gitRepository, $childRepository),
new RemoveChildCommand($gitRepository, $childRepository),
new ListChildrenCommand($gitRepository, $childRepository),
new MergeIntoChildrenCommand($gitRepository, $childRepository),
new PushCommand($gitRepository, $childRepository),
]
);
$application->run();