parse($args); $from = $this->option($parsed['options'], 'from', Config::updateUrl()); $target = $this->option($parsed['options'], 'target', Config::binPath()); $temp = $this->option($parsed['options'], 'temp', sys_get_temp_dir()); $force = $this->flag($parsed['options'], 'force'); if ($from === null || $target === null) { $this->console->error('Faltan --from o --target.'); return 1; } $updater = new SelfUpdater($this->console); try { if ($this->flag($parsed['options'], 'check')) { $tag = $updater->available($from); $this->console->out(' actual: v' . Config::VERSION); $this->console->out(' disponible: ' . ($tag !== null ? 'v' . ltrim($tag, 'vV') : '(desconocido)')); return $tag === null || Semver::compare(Config::VERSION, ltrim($tag, 'vV')) >= 0 ? 0 : 1; } $updater->update($from, $target, $temp, $force); } catch (ToolboxException $e) { $this->console->error($e->getMessage()); return 1; } return 0; } }