Skip to content

Commit

Permalink
Merge pull request #3177 from voxel51/feature/plugins-all
Browse files Browse the repository at this point in the history
Adding --all flags to plugin CLI methods
  • Loading branch information
brimoor authored Jun 12, 2023
2 parents 6814863 + 84d01e7 commit 34b0899
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 6 deletions.
18 changes: 15 additions & 3 deletions docs/source/cli/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1122,7 +1122,7 @@ Enables the given plugin(s).

.. code-block:: text
fiftyone plugins enable [-h] [NAME ...]
fiftyone plugins enable [-h] [-a] [NAME ...]
**Arguments**

Expand All @@ -1133,6 +1133,7 @@ Enables the given plugin(s).
optional arguments:
-h, --help show this help message and exit
-a, --all whether to enable all plugins
**Examples**

Expand All @@ -1144,6 +1145,9 @@ Enables the given plugin(s).
# Enable multiple plugins
fiftyone plugins enable <name1> <name2> ...
# Enable all plugins
fiftyone plugins enable --all
.. _cli-fiftyone-plugins-disable:

Disable plugins
Expand All @@ -1153,7 +1157,7 @@ Disables the given plugin(s).

.. code-block:: text
fiftyone plugins disable [-h] [NAME ...]
fiftyone plugins disable [-h] [-a] [NAME ...]
**Arguments**

Expand All @@ -1164,6 +1168,7 @@ Disables the given plugin(s).
optional arguments:
-h, --help show this help message and exit
-a, --all whether to disable all plugins
**Examples**

Expand All @@ -1175,6 +1180,9 @@ Disables the given plugin(s).
# Disable multiple plugins
fiftyone plugins disable <name1> <name2> ...
# Disable all plugins
fiftyone plugins disable --all
.. _cli-fiftyone-plugins-delete:

Delete plugins
Expand All @@ -1184,7 +1192,7 @@ Delete plugins from your local machine.

.. code-block:: text
fiftyone plugins delete [-h] [NAME ...]
fiftyone plugins delete [-h] [-a] [NAME ...]
**Arguments**

Expand All @@ -1195,6 +1203,7 @@ Delete plugins from your local machine.
optional arguments:
-h, --help show this help message and exit
-a, --all whether to delete all plugins
**Examples**

Expand All @@ -1206,6 +1215,9 @@ Delete plugins from your local machine.
# Delete multiple plugins from local disk
fiftyone plugins delete <name1> <name2> ...
# Delete all plugins from local disk
fiftyone plugins delete --all
.. _cli-fiftyone-utils:

FiftyOne utilities
Expand Down
48 changes: 45 additions & 3 deletions fiftyone/core/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3072,6 +3072,9 @@ class PluginsEnableCommand(Command):
# Enable multiple plugins
fiftyone plugins enable <name1> <name2> ...
# Enable all plugins
fiftyone plugins enable --all
"""

@staticmethod
Expand All @@ -3082,10 +3085,21 @@ def setup(parser):
nargs="*",
help="the plugin name(s)",
)
parser.add_argument(
"-a",
"--all",
action="store_true",
help="whether to enable all plugins",
)

@staticmethod
def execute(parser, args):
for name in args.name:
if args.all:
names = fop.list_disabled_plugins()
else:
names = args.name

for name in names:
fop.enable_plugin(name)


Expand All @@ -3099,6 +3113,9 @@ class PluginsDisableCommand(Command):
# Disable multiple plugins
fiftyone plugins disable <name1> <name2> ...
# Disable all plugins
fiftyone plugins disable --all
"""

@staticmethod
Expand All @@ -3109,10 +3126,21 @@ def setup(parser):
nargs="*",
help="the plugin name(s)",
)
parser.add_argument(
"-a",
"--all",
action="store_true",
help="whether to disable all plugins",
)

@staticmethod
def execute(parser, args):
for name in args.name:
if args.all:
names = fop.list_enabled_plugins()
else:
names = args.name

for name in names:
fop.disable_plugin(name)


Expand All @@ -3126,6 +3154,9 @@ class PluginsDeleteCommand(Command):
# Delete multiple plugins from local disk
fiftyone plugins delete <name1> <name2> ...
# Delete all plugins from local disk
fiftyone plugins delete --all
"""

@staticmethod
Expand All @@ -3136,10 +3167,21 @@ def setup(parser):
nargs="*",
help="the plugin name(s)",
)
parser.add_argument(
"-a",
"--all",
action="store_true",
help="whether to delete all plugins",
)

@staticmethod
def execute(parser, args):
for name in args.name:
if args.all:
names = fop.list_downloaded_plugins()
else:
names = args.name

for name in names:
fop.delete_plugin(name)


Expand Down

0 comments on commit 34b0899

Please sign in to comment.