def list(self): """ List installed plugins. """ self.p_main('Finding installed plugins') plugins = backend.list_plugins() if len(plugins) == 0: self.p_sub('Found no plugins') return self.p_main('Installed plugins:') self.p_blank() max_name_len = max([len('[{}]{}'.format(p['installed_file'], p['plugin_name'])) for p in plugins]) max_ver_len = max([len(p['installed_version']) for p in plugins]) frmt = '{{:<{}}} - {{:<{}}}'.format(max_name_len, max_ver_len) for plugin in plugins: jar = plugin['installed_file'] name = plugin['plugin_name'] version = plugin['installed_version'] line = frmt.format('[{}]{}'.format(jar, name), version) newest_version = utils.select_newest_version(plugin, self.args.version) if newest_version is not None and \ newest_version['version'] > version: new_version = newest_version['version'] line += ' -- Out of date, newest version: {}'.format( new_version) self.p_sub(line) self.p_blank()
def update(self): """ Update installed plugins. """ self.args.ignored = [e.lower() for e in self.args.ignored] self.p_main('Finding installed plugins') installed = backend.list_plugins() self.p_main('Looking up versions on BukGet') to_update = list() for i in installed: if i['plugin_name'].lower() in self.args.ignored: self.p_sub('Ignoring {}', i['plugin_name']) continue n_version = utils.select_newest_version(i, self.args.version) if n_version is None: continue i_version = utils.select_installed_version(i) if n_version['version'] > i_version['version']: to_update.append(i) self.p_main('Plugins to update:') self.p_blank() if len(to_update) < 1: self.p_sub('All plugins are up to date!') self.p_sub(('Maybe you want a pre-release? Try passing --beta, ' '--alpha or even --latest as command options')) self.p_blank() return self.p_sub( common.list_names([ p['plugin_name'] + '#' + p['versions'][0]['version'] for p in to_update ])) self.p_blank() if common.ask('Continue to update?', skip=self.args.no_confirm): prefix_format = '({{part:>{}}}/{{total}}) '.format( len(str(len(to_update)))) for i in range(len(to_update)): plugin = to_update[i] os.remove(plugin['installed_file']) prefix = prefix_format.format(total=len(to_update), part=i + 1) backend.download_plugin(plugin, prefix) self.p_blank() self.p_raw('Done!')
def update(self): """ Update installed plugins. """ self.args.ignored = [e.lower() for e in self.args.ignored] self.p_main('Finding installed plugins') installed = backend.list_plugins() self.p_main('Looking up versions on BukGet') to_update = list() for i in installed: if i['plugin_name'].lower() in self.args.ignored: self.p_sub('Ignoring {}', i['plugin_name']) continue n_version = utils.select_newest_version(i, self.args.version) if n_version is None: continue i_version = utils.select_installed_version(i) if n_version['version'] > i_version['version']: to_update.append(i) self.p_main('Plugins to update:') self.p_blank() if len(to_update) < 1: self.p_sub('All plugins are up to date!') self.p_sub(('Maybe you want a pre-release? Try passing --beta, ' '--alpha or even --latest as command options')) self.p_blank() return self.p_sub(common.list_names([p['plugin_name'] + '#' + p['versions'][0]['version'] for p in to_update])) self.p_blank() if common.ask('Continue to update?', skip=self.args.no_confirm): prefix_format = '({{part:>{}}}/{{total}}) '.format( len(str(len(to_update)))) for i in range(len(to_update)): plugin = to_update[i] os.remove(plugin['installed_file']) prefix = prefix_format.format(total=len(to_update), part=i+1) backend.download_plugin(plugin, prefix) self.p_blank() self.p_raw('Done!')
def list(self): """ List installed plugins. """ self.p_main('Finding installed plugins') plugins = backend.list_plugins() if len(plugins) == 0: self.p_sub('Found no plugins') return self.p_main('Installed plugins:') self.p_blank() max_name_len = max([ len('[{}]{}'.format(p['installed_file'], p['plugin_name'])) for p in plugins ]) max_ver_len = max([len(p['installed_version']) for p in plugins]) frmt = '{{:<{}}} - {{:<{}}}'.format(max_name_len, max_ver_len) for plugin in plugins: jar = plugin['installed_file'] name = plugin['plugin_name'] version = plugin['installed_version'] line = frmt.format('[{}]{}'.format(jar, name), version) newest_version = utils.select_newest_version( plugin, self.args.version) if newest_version is not None and \ newest_version['version'] > version: new_version = newest_version['version'] line += ' -- Out of date, newest version: {}'.format( new_version) self.p_sub(line) self.p_blank()