File fix-add-group-extras.patch of Package opi
diff -ruNp a/bin/opi b/bin/opi
--- a/bin/opi
+++ b/bin/opi
@@ -35,6 +35,12 @@ class PreserveWhiteSpaceWrapRawTextHelpF
def setup_argparser(plugin_manager):
+ extras = plugin_manager.get_plugin_string(' ' * 2, 'extras')
+ if extras:
+ extras = textwrap.dedent('''\
+ \nThese queries are provided by plugins that are not part of the opi package:
+ ''') + extras
+
ap = argparse.ArgumentParser(
formatter_class=PreserveWhiteSpaceWrapRawTextHelpFormatter,
description=textwrap.dedent('''\
@@ -49,7 +55,7 @@ def setup_argparser(plugin_manager):
'''),
epilog=textwrap.dedent('''\
Also these queries (provided by plugins) can be used to install packages from various other vendors:
- ''') + plugin_manager.get_plugin_string(' ' * 2))
+ ''') + plugin_manager.get_plugin_string(' ' * 2) + extras)
ap.add_argument('query', nargs='*', type=str, help=textwrap.dedent('''\
can be any package name or part of it and will be searched for both at the openSUSE Build Service and Packman.
diff -ruNp a/opi/plugins/__init__.py b/opi/plugins/__init__.py
--- a/opi/plugins/__init__.py
+++ b/opi/plugins/__init__.py
@@ -7,6 +7,7 @@ class BasePlugin:
main_query = ''
description = ''
queries = []
+ group = ''
@classmethod
def matches(cls, query):
@@ -38,9 +39,11 @@ class PluginManager:
pass
return True
- def get_plugin_string(self, indent=''):
+ def get_plugin_string(self, indent='', group=''):
plugins = ''
for plugin in self.plugins:
+ if group != 'all' and plugin.group != group:
+ continue
description = plugin.description.replace('\n', '\n' + (' ' * 16) + ' ')
plugins += f'{indent}{plugin.main_query:16} {description}\n'
return plugins