igor-kozhevnikov / cross
Library for creating console commands
Installs: 145
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/igor-kozhevnikov/cross
Requires
- php: ^8.1
- igor-kozhevnikov/fluent: ^1.1
- symfony/console: ^6.0|^7.0
- symfony/process: ^6.0|^7.0
Requires (Dev)
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^10.1
- squizlabs/php_codesniffer: ^3.7
README
Library for creating console commands.
Install
composer required igor-kozhevnikov/cross
Configuration
Run the follow command to create config.
Available extensions: php json.
./vendor/bin/cross config [<extension>]
A cross.php or cross.json config file locates in the root directory.
The plugins and commands array contains definitions and configurations of
plugins and commands.
For example:
<?php return [ 'plugins' => [ \Cross\Docker\Plugin\Plugin::class => [ 'env_path' => 'docker/.env' ], \Cross\Git\Plugin\Plugin::class, ], 'command' => [ \Cross\Docker\Commands\SSH::class => [ 'container' => 'packager_workspace' ], \Cross\Git\Commands\Snapshot::class => [ 'is_use_add' => false ], ], ];
{
"plugins": {
"\\Cross\\Docker\\Plugin\\Plugin": { "env_path": "docker/.env" },
"\\Cross\\Git\\Plugin\\Plugin": {}
},
"commands": {
"\\Cross\\Docker\\Commands\\SSH": { "container": "packager_workspace" },
"\\Cross\\Git\\Commands\\Snapshot": { "is_use_add": false }
}
}
Commands
Display all command
./vendor/bin/cross
Make config
./vendor/bin/cross config [<extension>]
Arguments:
extensionExtension of config file. Available values:phpjson.
Examples
You can see commands based on this package in the following repositories:
Alias
Add the following code to ~/.zshrc file to create the x alias.
CROSS_LOCAL=./vendor/bin/cross CROSS_GLOBAL=~/.composer/vendor/bin/cross cross() { if [[ -f $CROSS_LOCAL ]]; then eval "alias x='${CROSS_LOCAL}'" elif [[ -f $CROSS_GLOBAL ]]; then eval "alias x='${CROSS_GLOBAL}'" else eval "alias x='echo The Cross package is not installed'" fi } add-zsh-hook chpwd cross eval cross
And use x command instead of ./vendor/bin/cross command.
License
The Cross is open-sourced software licensed under the MIT license.