-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathCommandHandlerInterface.php
104 lines (86 loc) · 1.98 KB
/
CommandHandlerInterface.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
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php declare(strict_types=1);
/**
* The file is part of inhere/console
*
* @author https://github.com/inhere
* @homepage https://github.com/inhere/php-console
* @license https://github.com/inhere/php-console/blob/master/LICENSE
*/
namespace Inhere\Console\Contract;
use Inhere\Console\AbstractApplication;
use Inhere\Console\Application;
/**
* Interface CommandHandlerInterface
*
* @package Inhere\Console\Contract
*/
interface CommandHandlerInterface
{
public const OK = 0;
public const ERR = 2;
// name -> {name}
public const ANNOTATION_VAR = '{%s}'; // '{$%s}';
// {$%s} name -> {name}
public const HELP_VAR_LEFT = '{';
public const HELP_VAR_RIGHT = '}';
/**
* Run command
*
* @param array $args
*
* @return mixed return int is exit code. other is command exec result.
*/
public function run(array $args): mixed;
/**
* @return Application
*/
public function getApp(): Application;
/**
* The input group name.
*
* @return string
*/
public function getGroupName(): string;
/**
* The real group or command name. Alias of the getName()
*
* @return string
*/
public function getRealName(): string;
/**
* @return string
*/
public function getRealDesc(): string;
/**
* The real group name.
*
* @return string
*/
public function getRealGName(): string;
/**
* The real command name.
*
* @return string
*/
public function getRealCName(): string;
/**
* The input command/subcommand name.
*
* @return string
*/
public function getCommandName(): string;
/**
* @param bool $useReal
*
* @return string
*/
public function getCommandId(bool $useReal = true): string;
/**
* @return string
*/
public static function getName(): string;
/**
* @return string
*/
public static function getDesc(): string;
}