maslosoft/sitcom

基于信号的命令行应用程序包装器

2.0.0 2023-05-11 15:25 UTC

This package is auto-updated.

Last update: 2024-09-11 18:12:36 UTC


README

Sitcom Logo Maslosoft Sitcom

基于信号的命令行应用程序包装器

Latest Stable Version License Scrutinizer Code Quality Code Coverage

快速安装

composer require maslosoft/sitcom

文档

完整的 Sitcom 文档

关键命令组合

Sitcom 允许您收集散布在应用程序中的所有命令,并在公共环境中使它们可用。

Sitcom 允许您从多个来源在一个可执行文件中调用命令。

注意:目前这仅适用于自包含的命令。如果命令依赖于其应用程序,则不会提供给它。

要将命令添加到 Sitcom,请通过信号添加,以下是从 hedron 的示例

// Use statments skipped
class RenderTemplateCommand extends Symfony\Component\Console\Command\Command
{
	protected function configure()
	{
		// irrelevant
	}

	protected function execute(InputInterface $input, OutputInterface $output)
	{
		// irrelevant
	}
	
	/**
	 * @SlotFor(Maslosoft\Sitcom\Command)
	 * @param Maslosoft\Signals\Command $signal
	 */
	public function reactOn(\Maslosoft\Sitcom\Command $signal)
	{
		$signal->add($this, 'hedron');
	}

调用 sitcom collect,这将生成命令列表。

现在调用 sitcom 来列出命令,以下是输出

   _____ _ __
  / ___/(_) /__________  ____ ___
  \__ \/ / __/ ___/ __ \/ __ `__ \
 ___/ / / /_/ /__/ /_/ / / / / / /
/____/_/\__/\___/\____/_/ /_/ /_/

Sitcom version 1.0.0

Usage:
 command [options] [arguments]

Options:
 --help (-h)           Display this help message
 --quiet (-q)          Do not output any message
 --verbose (-v|vv|vvv) Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
 --version (-V)        Display this application version
 --ansi                Force ANSI output
 --no-ansi             Disable ANSI output
 --no-interaction (-n) Do not ask any interactive question

Available commands:
 collect          Build a list of commands
 help             Displays help for a command
 list             Lists commands
hedron
 hedron:commit    Apply headers to all php classes
 hedron:preview   Show list of files to which headers will be applied
 hedron:show      Show how current template will look like