Files
pallectrum/electrum/plugins/labels/__init__.py
ThomasV e67cb560f6 Commands: add option documentation in docstring.
This allows plugins to document the commands they add.

The docstring is parsed as a regular expression:

    arg:<type>:<name>:<description>\n

Types are defined in commands.arg_types.

Note that this commit removes support for single letter
shortcuts in command options.

If a command is not properly documented, a warning is issued
with print(), because no logger is available at this point.
2025-03-19 13:03:38 +01:00

24 lines
678 B
Python

from electrum.commands import plugin_command
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from .labels import LabelsPlugin
from electrum.commands import Commands
plugin_name = "labels"
@plugin_command('w', plugin_name)
async def push(self: 'Commands', plugin: 'LabelsPlugin' = None, wallet=None) -> int:
""" push labels to server """
return await plugin.push_thread(wallet)
@plugin_command('w', plugin_name)
async def pull(self: 'Commands', plugin: 'LabelsPlugin' = None, wallet=None, force=False) -> int:
"""
pull missing labels from server
arg:bool:force:pull all labels
"""
return await plugin.pull_thread(wallet, force=force)