first commit
This commit is contained in:
24
bin/rector
Normal file
24
bin/rector
Normal file
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
$target = __DIR__.'/../vendor/bin/rector';
|
||||
|
||||
// Get arguments from CLI
|
||||
$args = $argv;
|
||||
array_shift($args); // Remove script name
|
||||
|
||||
// Add --ansi to keep colored output
|
||||
$args[] = '--ansi';
|
||||
|
||||
$hasConfigArg = (bool) array_filter($args, fn ($arg) => str_starts_with($arg, '--config=') || str_starts_with($arg, '--c'));
|
||||
// Config option is not set, so use default rector config
|
||||
if (!$hasConfigArg) {
|
||||
$args[] = '--config="'.__DIR__.'/../rector.php'.'"';
|
||||
}
|
||||
|
||||
// Build the final command
|
||||
$command = escapeshellcmd($target) . ' ' . implode(' ', $args);
|
||||
|
||||
// Run the command and passthrough output
|
||||
passthru($command, $exitCode);
|
||||
exit($exitCode);
|
||||
Reference in New Issue
Block a user