digipolisgent / command-builder
A generic shell command builder.
Installs: 30 603
Dependents: 3
Suggesters: 0
Security: 0
Stars: 0
Watchers: 7
Forks: 0
Open Issues: 1
Requires
- php: >=7.0
Requires (Dev)
- phpunit/phpunit: ~6
This package is auto-updated.
Last update: 2024-11-07 15:21:04 UTC
README
Code example
<?php require_once 'vendor/autoload.php'; use DigipolisGent\CommandBuilder\CommandBuilder; $builder = CommandBuilder::create('ls') ->addFlag('a') ->addFlag('l') ->pipeOutputTo('grep') ->addArgument('mydir') ->onSuccess('echo') ->addArgument('mydir already exists') ->onFailure( CommandBuilder::create('mkdir') ->addArgument('mydir') ->onSuccess('echo') ->addArgument('mydir created') ); print $builder;
Output
{ { { ls -a -l | grep 'mydir'; } && echo 'mydir already exists'; } || { mkdir 'mydir' && echo 'mydir created'; }; }