-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathplugins.py
More file actions
27 lines (20 loc) · 821 Bytes
/
plugins.py
File metadata and controls
27 lines (20 loc) · 821 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# -*- coding: utf-8 -*-
# This file is part of the CloudBlue Connect connect-cli.
# Copyright (c) 2019-2025 CloudBlue. All Rights Reserved.
import click
from connect.cli.core.utils import iter_entry_points
def load_plugins(cli):
@click.group(name='plugin', short_help='Third party plugins.')
def grp_plugins():
pass # pragma: no cover
has_3rd_party_plugins = False
for entrypoint in iter_entry_points('connect.cli.plugins'):
if entrypoint.value.startswith('connect.cli.plugins.'):
command_fn = entrypoint.load()
cli.add_command(command_fn())
else:
has_3rd_party_plugins = True
command_fn = entrypoint.load()
grp_plugins.add_command(command_fn())
if has_3rd_party_plugins:
cli.add_command(grp_plugins)