def plugins(self, folder, args): t = Terminal() enabled_plugins = folder.load_plugins() available_plugins = utils.get_installed_plugins() if args.enable: if args.set_global: utils.set_global_config_value( 'plugins', args.enable, 'enabled', ) else: folder.set_config_value( 'plugins', args.enable, 'enabled' ) elif args.disable: if args.set_global: utils.set_global_config_value( 'plugins', args.disable, 'disabled', ) else: folder.set_config_value( 'plugins', args.disable, 'disabled' ) else: all_plugins = self.build_plugin_dict( enabled_plugins, available_plugins ) for plugin_name, plugin_data in all_plugins.items(): if plugin_data['enabled'] and args.disabled_only: continue if not plugin_data['enabled'] and args.enabled_only: continue if plugin_data['enabled']: color = t.bold else: color = t.normal print( color + plugin_name + t.normal + ( ' (Enabled)' if plugin_data['enabled'] else ( ' (Disabled; enable by running `jirafs ' 'plugins --enable=%s`)' % plugin_name ) ) ) if args.verbose: doc_string = ( plugin_data['class'].__doc__.strip().split('\n') ) for line in doc_string: print(' %s' % line)
def main(self, folder, args): t = Terminal() enabled_plugins = folder.load_plugins() available_plugins = utils.get_installed_plugins() if args.enable: if args.set_global: utils.set_global_config_value( 'plugins', args.enable, 'enabled', ) else: folder.set_config_value('plugins', args.enable, 'enabled') elif args.disable: if args.set_global: utils.set_global_config_value( 'plugins', args.disable, 'disabled', ) else: folder.set_config_value('plugins', args.disable, 'disabled') print( "{t.red}{t.bold}Warning{t.normal}{t.red}: Disabling of macro " "plugins may result in you encountering problems working with " "folders using a macro. If you encounter a problem, consider " "running `jirafs macropatch reset` to clear the " "currently-applied macros on a given ticket.{t.normal}".format( t=t)) else: all_plugins = self.build_plugin_dict(enabled_plugins, available_plugins) for plugin_name, plugin_data in all_plugins.items(): if plugin_data['enabled'] and args.disabled_only: continue if not plugin_data['enabled'] and args.enabled_only: continue if plugin_data['enabled']: color = t.bold else: color = t.normal print(color + plugin_name + t.normal + (' (Enabled)' if plugin_data['enabled'] else (' (Disabled; enable by running `jirafs ' 'plugins --enable=%s`)' % plugin_name))) if args.verbose: doc_string = ( plugin_data['class'].__doc__.strip().split('\n')) for line in doc_string: print(' %s' % line)
def main(self, folder, args): t = Terminal() enabled_plugins = folder.load_plugins() available_plugins = utils.get_installed_plugins() if args.enable: if args.set_global: utils.set_global_config_value( "plugins", args.enable, "enabled", ) else: folder.set_config_value("plugins", args.enable, "enabled") elif args.disable: if args.set_global: utils.set_global_config_value( "plugins", args.disable, "disabled", ) else: folder.set_config_value("plugins", args.disable, "disabled") else: all_plugins = self.build_plugin_dict(enabled_plugins, available_plugins) for entrypoint_name, plugin_data in all_plugins.items(): if plugin_data["enabled"] and args.disabled_only: continue if not plugin_data["enabled"] and args.enabled_only: continue if plugin_data["enabled"]: color = t.bold else: color = t.normal print(color + entrypoint_name + t.normal + (" (Enabled)" if plugin_data["enabled"] else (" (Disabled; enable by running `jirafs " "plugins --enable=%s`)" % entrypoint_name))) if args.verbose: doc_string = plugin_data["class"].__doc__.strip().split( "\n") for line in doc_string: print(" %s" % line)
def plugins(self, folder, args): t = Terminal() enabled_plugins = folder.load_plugins() available_plugins = utils.get_installed_plugins() if args.enable: if args.set_global: utils.set_global_config_value( 'plugins', args.enable, 'enabled', ) else: folder.set_config_value('plugins', args.enable, 'enabled') elif args.disable: if args.set_global: utils.set_global_config_value( 'plugins', args.disable, 'disabled', ) else: folder.set_config_value('plugins', args.disable, 'disabled') else: all_plugins = self.build_plugin_dict(enabled_plugins, available_plugins) for plugin_name, plugin_data in all_plugins.items(): if plugin_data['enabled'] and args.disabled_only: continue if not plugin_data['enabled'] and args.enabled_only: continue if plugin_data['enabled']: color = t.bold else: color = t.normal print(color + plugin_name + t.normal + (' (Enabled)' if plugin_data['enabled'] else (' (Disabled; enable by running `jirafs ' 'plugins --enable=%s`)' % plugin_name))) if args.verbose: doc_string = ( plugin_data['class'].__doc__.strip().split('\n')) for line in doc_string: print(' %s' % line)
def set_global(self, section, key, value): return utils.set_global_config_value(section, key, value)
def main(self, folder, args): t = Terminal() enabled_plugins = folder.load_plugins() available_plugins = utils.get_installed_plugins() if args.enable: if args.set_global: utils.set_global_config_value( 'plugins', args.enable, 'enabled', ) else: folder.set_config_value( 'plugins', args.enable, 'enabled' ) elif args.disable: if args.set_global: utils.set_global_config_value( 'plugins', args.disable, 'disabled', ) else: folder.set_config_value( 'plugins', args.disable, 'disabled' ) print( "{t.red}{t.bold}Warning{t.normal}{t.red}: Disabling of macro " "plugins may result in you encountering problems working with " "folders using a macro. If you encounter a problem, consider " "running `jirafs macropatch reset` to clear the " "currently-applied macros on a given ticket.{t.normal}".format( t=t ) ) else: all_plugins = self.build_plugin_dict( enabled_plugins, available_plugins ) for plugin_name, plugin_data in all_plugins.items(): if plugin_data['enabled'] and args.disabled_only: continue if not plugin_data['enabled'] and args.enabled_only: continue if plugin_data['enabled']: color = t.bold else: color = t.normal print( color + plugin_name + t.normal + ( ' (Enabled)' if plugin_data['enabled'] else ( ' (Disabled; enable by running `jirafs ' 'plugins --enable=%s`)' % plugin_name ) ) ) if args.verbose: doc_string = ( plugin_data['class'].__doc__.strip().split('\n') ) for line in doc_string: print(' %s' % line)