ShellPathCompletion.php
1.32 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
namespace Stecman\Component\Symfony\Console\BashCompletion\Completion;
/**
* Shell Path Completion
*
* Defers completion to the calling shell's built-in path completion functionality.
*/
class ShellPathCompletion implements CompletionInterface
{
/**
* Exit code set up to trigger path completion in the completion hooks
* @see Stecman\Component\Symfony\Console\BashCompletion\HookFactory
*/
const PATH_COMPLETION_EXIT_CODE = 200;
protected $type;
protected $commandName;
protected $targetName;
public function __construct($commandName, $targetName, $type)
{
$this->commandName = $commandName;
$this->targetName = $targetName;
$this->type = $type;
}
/**
* @inheritdoc
*/
public function getType()
{
return $this->type;
}
/**
* @inheritdoc
*/
public function getCommandName()
{
return $this->commandName;
}
/**
* @inheritdoc
*/
public function getTargetName()
{
return $this->targetName;
}
/**
* Exit with a status code configured to defer completion to the shell
*
* @see \Stecman\Component\Symfony\Console\BashCompletion\HookFactory::$hooks
*/
public function run()
{
exit(self::PATH_COMPLETION_EXIT_CODE);
}
}