Skip to content

Commit

Permalink
Add plugin subcommand
Browse files Browse the repository at this point in the history
  • Loading branch information
soapy1 committed Jan 3, 2025
1 parent c53e386 commit 791ac06
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/_nebari/subcommands/plugin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import rich
import typer
from rich.table import Table

from importlib.metadata import version

from _nebari.version import __version__
from nebari.hookspecs import hookimpl

@hookimpl
def nebari_subcommand(cli: typer.Typer):
plugin_cmd = typer.Typer(
help="Interact with nebari plugins",
)

@plugin_cmd.command()
def list(ctx: typer.Context):
"""
List installed plugins
"""
from nebari.plugins import nebari_plugin_manager

external_plugins = nebari_plugin_manager.get_external_plugins()

table = Table(title="Plugins")
table.add_column("name", justify="left", no_wrap=True)
table.add_column("version", justify="left", no_wrap=True)

for plugin in external_plugins:
table.add_row(plugin, version(plugin))

rich.print(table)

cli.add_typer(plugin_cmd, name="plugin", rich_help_panel="Additional Commands")
1 change: 1 addition & 0 deletions src/nebari/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"_nebari.subcommands.deploy",
"_nebari.subcommands.destroy",
"_nebari.subcommands.keycloak",
"_nebari.subcommands.plugin",
"_nebari.subcommands.render",
"_nebari.subcommands.support",
"_nebari.subcommands.upgrade",
Expand Down

0 comments on commit 791ac06

Please sign in to comment.