public function handle() { $githubProjects = []; $choices = []; foreach ($this->factory->getProjects() as $project) { if ($project->config('enable_github_hook', false) && $project->config('github_hook_settings.sync.enabled', false)) { $githubProjects[] = $project; $choices[] = $project->getName(); } } $project = $this->choice('Pick the github enabled project you wish to sync', $choices); if ($this->option('queue')) { $this->queue->push(\Docit\Hooks\Github\Commands\GithubSyncProject::class, ['project' => $project]); } else { $project = $this->factory->getProject($project); $total = count($project->githubSync()->getBranchesToSync()) + count($project->githubSync()->getVersionsToSync()); if ($total === 0) { $this->info('Nothing to sync. Everything is up-to-date'); return; } $this->output->progressStart($total); $that = $this; $project->githubSync()->syncWithProgress(function ($current) use($that) { $that->output->progressAdvance(); }); $this->output->progressFinish(); $this->info('Synchronised ' . $total . ' versions/branches'); } }