|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* This file is part of CaptainHook |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Sebastian Feldmann <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace CaptainHook\App\Console\Application; |
|
13
|
|
|
|
|
14
|
|
|
use CaptainHook\App\Console\Application; |
|
15
|
|
|
use CaptainHook\App\Console\Command as Cmd; |
|
16
|
|
|
use CaptainHook\App\Console\Runtime\Resolver; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* Class Cli |
|
20
|
|
|
* |
|
21
|
|
|
* @package CaptainHook |
|
22
|
|
|
* @author Sebastian Feldmann <[email protected]> |
|
23
|
|
|
* @link https://github.com/captainhookphp/captainhook |
|
24
|
|
|
* @since Class available since Release 5.0.0 |
|
25
|
|
|
*/ |
|
26
|
|
|
class Cli extends Application |
|
27
|
|
|
{ |
|
28
|
|
|
/** |
|
29
|
|
|
* Path to captainhook binary |
|
30
|
|
|
* |
|
31
|
|
|
* @var string |
|
32
|
|
|
*/ |
|
33
|
|
|
protected $executable; |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* Cli constructor. |
|
37
|
|
|
* |
|
38
|
|
|
* @param string $executable |
|
39
|
|
|
*/ |
|
40
|
|
|
public function __construct(string $executable) |
|
41
|
|
|
{ |
|
42
|
|
|
$this->executable = $executable; |
|
43
|
|
|
|
|
44
|
|
|
parent::__construct(); |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* Initializes all the CaptainHook commands |
|
49
|
|
|
* |
|
50
|
|
|
* @return \Symfony\Component\Console\Command\Command[] |
|
51
|
|
|
*/ |
|
52
|
|
|
public function getDefaultCommands(): array |
|
53
|
|
|
{ |
|
54
|
|
|
$resolver = new Resolver(); |
|
55
|
|
|
|
|
56
|
|
|
return array_merge( |
|
57
|
|
|
parent::getDefaultCommands(), |
|
58
|
|
|
[ |
|
59
|
|
|
new Cmd\Install($resolver, $this->executable), |
|
60
|
|
|
new Cmd\Configuration(), |
|
61
|
|
|
new Cmd\Add(), |
|
62
|
|
|
new Cmd\Disable(), |
|
63
|
|
|
new Cmd\Enable(), |
|
64
|
|
|
new Cmd\Hook\CommitMsg($resolver), |
|
65
|
|
|
new Cmd\Hook\PostCheckout($resolver), |
|
66
|
|
|
new Cmd\Hook\PostCommit($resolver), |
|
67
|
|
|
new Cmd\Hook\PostMerge($resolver), |
|
68
|
|
|
new Cmd\Hook\PreCommit($resolver), |
|
69
|
|
|
new Cmd\Hook\PrepareCommitMsg($resolver), |
|
70
|
|
|
new Cmd\Hook\PrePush($resolver), |
|
71
|
|
|
] |
|
72
|
|
|
); |
|
73
|
|
|
} |
|
74
|
|
|
} |
|
75
|
|
|
|