Skip to content

Commit 3ee274a

Browse files
committed
add example to plugincommandcontext
1 parent 17158e9 commit 3ee274a

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

python/plugin.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,17 @@
3737
from . import highlevelil
3838

3939

40-
class PluginCommandContext:
40+
class PluginCommandContext: """
41+
The ``class PluginCommandContext`` is used to access loaded plugins and their exposed methods with the context of a specific Binary VIew.
42+
43+
:Example:
44+
# To trigger a registered plugin with a BinaryView, for example:
45+
>>> bv = load("/tmp/file1")
46+
>>> ctx = PluginCommandContext(bv);
47+
>>> binexport = PluginCommand.get_valid_list(ctx)["BinExport"]
48+
>>> binexport.execute(ctx)
49+
"""
50+
4151
def __init__(self, view):
4252
self._view = view
4353
self._address = 0
@@ -834,7 +844,7 @@ def is_valid(self, context):
834844

835845
def execute(self, context):
836846
r"""
837-
``execute`` Execute a Plugin
847+
``execute`` Execute a plugin. See the example in :class:`~PluginCommandContext`
838848
839849
:param str context: PluginCommandContext to pass the PluginCommand
840850
:rtype: None

0 commit comments

Comments
 (0)