mirror of
https://github.com/peklaiho/madlisp.git
synced 2024-11-22 13:24:46 +00:00
find autoload.php from multiple locations, support --help flag
This commit is contained in:
parent
c53eba8d23
commit
cd8e4c1005
17
bin/madlisp
17
bin/madlisp
@ -1,11 +1,20 @@
|
|||||||
#!/usr/bin/env php
|
#!/usr/bin/env php
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (php_sapi_name() != 'cli') {
|
$autoload = null;
|
||||||
exit('Currently only cli usage is supported.');
|
foreach ([__DIR__ . '/../../autoload.php', __DIR__ . '/../vendor/autoload.php', __DIR__ . '/vendor/autoload.php'] as $file) {
|
||||||
|
if (file_exists($file)) {
|
||||||
|
$autoload = $file;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
require(__DIR__ . '/../vendor/autoload.php');
|
if ($autoload) {
|
||||||
|
require($autoload);
|
||||||
|
} else {
|
||||||
|
print('Unable to find Composer autoloader.' . PHP_EOL);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
function ml_help()
|
function ml_help()
|
||||||
{
|
{
|
||||||
@ -86,7 +95,7 @@ for ($i = 1; $i < $argc; $i++) {
|
|||||||
$debugMode = true;
|
$debugMode = true;
|
||||||
} elseif ($a == '-e') {
|
} elseif ($a == '-e') {
|
||||||
|
|
||||||
} elseif ($a == '-h') {
|
} elseif ($a == '-h' || $a == '--help') {
|
||||||
ml_help(); // exit
|
ml_help(); // exit
|
||||||
} elseif ($a == '-q') {
|
} elseif ($a == '-q') {
|
||||||
$loadInit = false;
|
$loadInit = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user