From 49bc91430d0e18a351d19a1dea65eae91f6c8f95 Mon Sep 17 00:00:00 2001 From: munix9 <44939650+munix9@users.noreply.github.com> Date: Wed, 28 May 2025 08:11:24 +0200 Subject: [PATCH 1/3] Update bin/opi --- bin/opi | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bin/opi b/bin/opi index eb81503..a20a88b 100755 --- a/bin/opi +++ b/bin/opi @@ -35,6 +35,12 @@ class PreserveWhiteSpaceWrapRawTextHelpFormatter(argparse.RawTextHelpFormatter): 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. From 9fafd7c7d9522ea58cde2fd82c1c3382c70d7227 Mon Sep 17 00:00:00 2001 From: munix9 <44939650+munix9@users.noreply.github.com> Date: Wed, 28 May 2025 08:12:54 +0200 Subject: [PATCH 2/3] Update opi/plugins/__init__.py --- opi/plugins/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/opi/plugins/__init__.py b/opi/plugins/__init__.py index 86ccdda..fb883d7 100644 --- 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 @@ def run(self, query): 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 From fb02f72fb34a0a9531f99aa17ad342bc3d1282c2 Mon Sep 17 00:00:00 2001 From: munix9 <44939650+munix9@users.noreply.github.com> Date: Wed, 28 May 2025 08:14:27 +0200 Subject: [PATCH 3/3] Add opi/plugins/netbeans.py --- opi/plugins/netbeans.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 opi/plugins/netbeans.py diff --git a/opi/plugins/netbeans.py b/opi/plugins/netbeans.py new file mode 100644 index 0000000..2e9f357 --- /dev/null +++ b/opi/plugins/netbeans.py @@ -0,0 +1,17 @@ +import opi +from opi.plugins import BasePlugin +from opi import github + +class NetBeans(BasePlugin): + main_query = 'netbeans' + description = 'Development environment, tooling platform and application framework' + queries = ['netbeans', 'NetBeans'] + group = 'extras' + + @classmethod + def run(cls, query): + arch = opi.get_cpu_arch() + github.install_rpm_release('Friends-of-Apache-NetBeans', 'netbeans-installers', + filters=[lambda a: a['name'].endswith(f'{arch}.rpm')], + allow_unsigned=True # no key available + )