mirror of
https://github.com/Hopiu/llm.git
synced 2026-05-13 08:13:14 +00:00
llm plugins --all option, closes #259
This commit is contained in:
parent
b84f6f9ffd
commit
6012f31e36
4 changed files with 7 additions and 5 deletions
|
|
@ -436,6 +436,7 @@ Usage: llm plugins [OPTIONS]
|
|||
List installed plugins
|
||||
|
||||
Options:
|
||||
--all Include built-in default plugins
|
||||
--help Show this message and exit.
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -40,11 +40,11 @@ __all__ = [
|
|||
]
|
||||
|
||||
|
||||
def get_plugins():
|
||||
def get_plugins(all=False):
|
||||
plugins = []
|
||||
plugin_to_distinfo = dict(pm.list_plugin_distinfo())
|
||||
for plugin in pm.get_plugins():
|
||||
if plugin.__name__.startswith("llm.default_plugins."):
|
||||
if not all and plugin.__name__.startswith("llm.default_plugins."):
|
||||
continue
|
||||
plugin_info = {
|
||||
"name": plugin.__name__,
|
||||
|
|
|
|||
|
|
@ -927,9 +927,10 @@ def aliases_path():
|
|||
|
||||
|
||||
@cli.command(name="plugins")
|
||||
def plugins_list():
|
||||
@click.option("--all", help="Include built-in default plugins", is_flag=True)
|
||||
def plugins_list(all):
|
||||
"List installed plugins"
|
||||
click.echo(json.dumps(get_plugins(), indent=2))
|
||||
click.echo(json.dumps(get_plugins(all), indent=2))
|
||||
|
||||
|
||||
def display_truncated(text):
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ if LLM_LOAD_PLUGINS is not None:
|
|||
mod = entry_point.load()
|
||||
pm.register(mod, name=entry_point.name)
|
||||
# Ensure name can be found in plugin_to_distinfo later:
|
||||
pm._plugin_distinfo.append(mod, distribution) # type: ignore
|
||||
pm._plugin_distinfo.append((mod, distribution)) # type: ignore
|
||||
except pkg_resources.DistributionNotFound:
|
||||
sys.stderr.write("Plugin {} could not be found\n".format(package_name))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue