ci4

Форк
0
/
Help.php 
87 строк · 1.8 Кб
1
<?php
2

3
declare(strict_types=1);
4

5
/**
6
 * This file is part of CodeIgniter 4 framework.
7
 *
8
 * (c) CodeIgniter Foundation <admin@codeigniter.com>
9
 *
10
 * For the full copyright and license information, please view
11
 * the LICENSE file that was distributed with this source code.
12
 */
13

14
namespace CodeIgniter\Commands;
15

16
use CodeIgniter\CLI\BaseCommand;
17

18
/**
19
 * CI Help command for the spark script.
20
 *
21
 * Lists the basic usage information for the spark script,
22
 * and provides a way to list help for other commands.
23
 */
24
class Help extends BaseCommand
25
{
26
    /**
27
     * The group the command is lumped under
28
     * when listing commands.
29
     *
30
     * @var string
31
     */
32
    protected $group = 'CodeIgniter';
33

34
    /**
35
     * The Command's name
36
     *
37
     * @var string
38
     */
39
    protected $name = 'help';
40

41
    /**
42
     * the Command's short description
43
     *
44
     * @var string
45
     */
46
    protected $description = 'Displays basic usage information.';
47

48
    /**
49
     * the Command's usage
50
     *
51
     * @var string
52
     */
53
    protected $usage = 'help [<command_name>]';
54

55
    /**
56
     * the Command's Arguments
57
     *
58
     * @var array<string, string>
59
     */
60
    protected $arguments = [
61
        'command_name' => 'The command name [default: "help"]',
62
    ];
63

64
    /**
65
     * the Command's Options
66
     *
67
     * @var array<string, string>
68
     */
69
    protected $options = [];
70

71
    /**
72
     * Displays the help for spark commands.
73
     */
74
    public function run(array $params)
75
    {
76
        $command = array_shift($params);
77
        $command ??= 'help';
78
        $commands = $this->commands->getCommands();
79

80
        if (! $this->commands->verifyCommand($command, $commands)) {
81
            return;
82
        }
83

84
        $class = new $commands[$command]['class']($this->logger, $this->commands);
85
        $class->showHelp();
86
    }
87
}
88

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.