承接 allapps2/shortcuts 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

allapps2/shortcuts

最新稳定版本:2.1.0

Composer 安装命令:

composer require allapps2/shortcuts

包简介

Console shortcuts for sets of commands

README 文档

README

Console tool to call sets of commands using short aliases.

A distinctive feature is that it is configured entirely in PHP, which means accessibility of code-completion, finding of usage, using of your application constants, validation and actually brings the whole range of PHP possibilities and your IDE features.

The disadvantage of this is that the configuration is more verbose compared to YAML and other simple formats, but it is negligible compared to the benefits that the integration into the host application brings.

installation

requirements

  • PHP 8.2+
    php-cli package is enough (for example on Alpine Linux it can be installed by apk add php82-cli).

download

download short.phar from https://github.com/allapps2/shortcuts/blob/main/bin/short.phar and put it into your project (for example to .for-auto-completion folder to be used by your IDE like PhpStorm for code auto-completion).

global install

to make sc alias available everywhere:

sudo php short.phar install-global

or any custom alias:

sudo php short.phar install-global myalias

usage

in folder with shortcuts.php:

sc [<shortcut> [<arguments>]]

example of shortcuts.php:

use Shortcuts\Command\CommandsCollection;
use Shortcuts\IBuilder;
use Shortcuts\Shortcut;
use Shortcuts\ShortcutArg;
use Shortcuts\ShortcutsCollection;
use Shortcuts\ShortcutsCollectionFactory;

class Shortcuts extends ShortcutsCollection
{
    function shortcut1(): CommandsCollection
    {
        return (new CommandsCollection)->add('long command1');
    }

    #[Shortcut(description: 'Shortcut description')]
    function shortcut2(
        string $requiredArgument,
        #[ShortcutArg(description: 'Optional argument')]
        string $optionalArgument = 'default value'
    ): CommandsCollection
    {
        return (new CommandsCollection)
            ->add('long command2 ' . $requiredArgument)
            ->add('long command3 ' . $optionalArgument);
    }
}

return new class implements IBuilder {
    function build(ShortcutsCollectionFactory $factory): ShortcutsCollection {
        return $factory->create(Shortcuts::class);
    }
};

for contributors

see CONTRIBUTING.md

统计信息

  • 总下载量: 26
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-11-25