Compare commits

..

No commits in common. "469413440523559715f9f45b1dc81fd0196d23e5" and "8c1e874b039cf501fd2f51572f19c2d4eae3f862" have entirely different histories.

2 changed files with 3 additions and 14 deletions

View File

@ -44,9 +44,6 @@ class Environment implements ArrayAccess
*/ */
public function readFromFile(string $filepath): static public function readFromFile(string $filepath): static
{ {
if (empty($filepath)) {
return $this;
}
$content = file_get_contents(static::$filepath = $filepath); $content = file_get_contents(static::$filepath = $filepath);
$content = json_decode($content, flags: JSON_THROW_ON_ERROR); //TODO try-catch $content = json_decode($content, flags: JSON_THROW_ON_ERROR); //TODO try-catch
$content || throw new JsonException("not a valid environment: $filepath"); $content || throw new JsonException("not a valid environment: $filepath");

View File

@ -26,7 +26,7 @@ class Processor
/** /**
* Converter version * Converter version
*/ */
public const VERSION = '1.6.1'; public const VERSION = '1.6.0';
/** /**
* @var int Initial timestamp * @var int Initial timestamp
@ -62,8 +62,6 @@ class Processor
* Constructor * Constructor
* *
* @param array $argv Arguments came from cli * @param array $argv Arguments came from cli
* @throws IncorrectSettingsFileException
* @throws JsonException
*/ */
public function __construct(protected readonly array $argv) public function __construct(protected readonly array $argv)
{ {
@ -85,9 +83,7 @@ class Processor
*/ */
protected function parseArgs(): void protected function parseArgs(): void
{ {
$arguments = array_slice($this->argv, 1); foreach ($this->argv as $idx => $arg) {
$needHelp = count($arguments) === 0 && !$this->settings::fileExists();
foreach ($arguments as $idx => $arg) {
switch ($arg) { switch ($arg) {
case '-f': case '-f':
case '--file': case '--file':
@ -166,13 +162,9 @@ class Processor
case '-h': case '-h':
case '--help': case '--help':
$needHelp = true; die(implode(EOL, $this->usage()) . EOL);
break;
} }
} }
if ($needHelp) {
die(implode(EOL, $this->usage()) . EOL);
}
if (empty($this->settings->collectionPaths())) { if (empty($this->settings->collectionPaths())) {
throw new InvalidArgumentException('there are no collections to convert'); throw new InvalidArgumentException('there are no collections to convert');
} }