Fixed execution without params
This commit is contained in:
parent
47930b010f
commit
2fd60a33bd
@ -44,6 +44,9 @@ class Environment implements ArrayAccess
|
||||
*/
|
||||
public function readFromFile(string $filepath): static
|
||||
{
|
||||
if (empty($filepath)) {
|
||||
return $this;
|
||||
}
|
||||
$content = file_get_contents(static::$filepath = $filepath);
|
||||
$content = json_decode($content, flags: JSON_THROW_ON_ERROR); //TODO try-catch
|
||||
$content || throw new JsonException("not a valid environment: $filepath");
|
||||
|
@ -83,7 +83,9 @@ class Processor
|
||||
*/
|
||||
protected function parseArgs(): void
|
||||
{
|
||||
foreach ($this->argv as $idx => $arg) {
|
||||
$arguments = array_slice($this->argv, 1);
|
||||
$needHelp = count($arguments) === 0 && !$this->settings::fileExists();
|
||||
foreach ($arguments as $idx => $arg) {
|
||||
switch ($arg) {
|
||||
case '-f':
|
||||
case '--file':
|
||||
@ -162,9 +164,13 @@ class Processor
|
||||
|
||||
case '-h':
|
||||
case '--help':
|
||||
die(implode(EOL, $this->usage()) . EOL);
|
||||
$needHelp = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($needHelp) {
|
||||
die(implode(EOL, $this->usage()) . EOL);
|
||||
}
|
||||
if (empty($this->settings->collectionPaths())) {
|
||||
throw new InvalidArgumentException('there are no collections to convert');
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user