mirror of
https://github.com/peklaiho/madlisp.git
synced 2024-11-22 05:14:45 +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
|
||||
<?php
|
||||
|
||||
if (php_sapi_name() != 'cli') {
|
||||
exit('Currently only cli usage is supported.');
|
||||
$autoload = null;
|
||||
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()
|
||||
{
|
||||
@ -86,7 +95,7 @@ for ($i = 1; $i < $argc; $i++) {
|
||||
$debugMode = true;
|
||||
} elseif ($a == '-e') {
|
||||
|
||||
} elseif ($a == '-h') {
|
||||
} elseif ($a == '-h' || $a == '--help') {
|
||||
ml_help(); // exit
|
||||
} elseif ($a == '-q') {
|
||||
$loadInit = false;
|
||||
|
Loading…
Reference in New Issue
Block a user