option('month')); $baseDirectory = trim((string) $this->option('base-dir')); if ($baseDirectory === '') { $this->error('必须指定 --base-dir。'); return self::FAILURE; } try { $result = $importer->import( (string) $this->argument('manifest'), $month, $baseDirectory, (string) $this->option('scope'), ); } catch (Throwable $exception) { report($exception); $this->error($exception->getMessage()); return self::FAILURE; } $this->info(json_encode($result, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)); if ($result['errors'] !== []) { foreach (array_slice($result['errors'], 0, 20) as $error) { $this->warn($error); } } return $result['stored'] > 0 || $result['skipped'] === 0 ? self::SUCCESS : self::FAILURE; } }