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.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -15,5 +15,9 @@ async def push(self: 'Commands', plugin: 'LabelsPlugin' = None, wallet=None) ->
|
||||
|
||||
@plugin_command('w', plugin_name)
|
||||
async def pull(self: 'Commands', plugin: 'LabelsPlugin' = None, wallet=None, force=False) -> int:
|
||||
""" pull labels from server """
|
||||
"""
|
||||
pull missing labels from server
|
||||
|
||||
arg:bool:force:pull all labels
|
||||
"""
|
||||
return await plugin.pull_thread(wallet, force=force)
|
||||
|
||||
@@ -134,12 +134,12 @@ if [[ $1 == "breach" ]]; then
|
||||
channel=$($alice open_channel $bob_node 0.15 --password='')
|
||||
new_blocks 3
|
||||
wait_until_channel_open alice
|
||||
request=$($bob add_request 0.01 --lightning -m "blah" | jq -r ".lightning_invoice")
|
||||
request=$($bob add_request 0.01 --lightning | jq -r ".lightning_invoice")
|
||||
echo "alice pays"
|
||||
$alice lnpay $request
|
||||
sleep 2
|
||||
ctx=$($alice get_channel_ctx $channel --iknowwhatimdoing)
|
||||
request=$($bob add_request 0.01 --lightning -m "blah2" | jq -r ".lightning_invoice")
|
||||
request=$($bob add_request 0.01 --lightning | jq -r ".lightning_invoice")
|
||||
echo "alice pays again"
|
||||
$alice lnpay $request
|
||||
echo "alice broadcasts old ctx"
|
||||
@@ -304,7 +304,7 @@ if [[ $1 == "extract_preimage" ]]; then
|
||||
wait_until_channel_open alice
|
||||
chan_id=$($alice list_channels | jq -r ".[0].channel_point")
|
||||
# alice pays bob
|
||||
invoice1=$($bob add_request 0.04 --lightning -m "test1" | jq -r ".lightning_invoice")
|
||||
invoice1=$($bob add_request 0.04 --lightning --memo "test1" | jq -r ".lightning_invoice")
|
||||
screen -S alice_payment -dm -L -Logfile /tmp/alice/screen1.log $alice lnpay $invoice1 --timeout=600
|
||||
sleep 1
|
||||
unsettled=$($alice list_channels | jq '.[] | .local_unsettled_sent')
|
||||
@@ -313,7 +313,7 @@ if [[ $1 == "extract_preimage" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
# bob pays alice
|
||||
invoice2=$($alice add_request 0.04 --lightning -m "test2" | jq -r ".lightning_invoice")
|
||||
invoice2=$($alice add_request 0.04 --lightning --memo "test2" | jq -r ".lightning_invoice")
|
||||
screen -S bob_payment -dm -L -Logfile /tmp/bob/screen2.log $bob lnpay $invoice2 --timeout=600
|
||||
sleep 1
|
||||
unsettled=$($bob list_channels | jq '.[] | .local_unsettled_sent')
|
||||
@@ -351,7 +351,7 @@ if [[ $1 == "redeem_htlcs" ]]; then
|
||||
new_blocks 3
|
||||
wait_until_channel_open alice
|
||||
# alice pays bob
|
||||
invoice=$($bob add_request 0.04 --lightning -m "test" | jq -r ".lightning_invoice")
|
||||
invoice=$($bob add_request 0.04 --lightning --memo "test" | jq -r ".lightning_invoice")
|
||||
$alice lnpay $invoice --timeout=1 || true
|
||||
unsettled=$($alice list_channels | jq '.[] | .local_unsettled_sent')
|
||||
if [[ "$unsettled" == "0" ]]; then
|
||||
@@ -393,7 +393,7 @@ if [[ $1 == "breach_with_unspent_htlc" ]]; then
|
||||
new_blocks 3
|
||||
wait_until_channel_open alice
|
||||
echo "alice pays bob"
|
||||
invoice=$($bob add_request 0.04 --lightning -m "test" | jq -r ".lightning_invoice")
|
||||
invoice=$($bob add_request 0.04 --lightning --memo "test" | jq -r ".lightning_invoice")
|
||||
$alice lnpay $invoice --timeout=1 || true
|
||||
unsettled=$($alice list_channels | jq '.[] | .local_unsettled_sent')
|
||||
if [[ "$unsettled" == "0" ]]; then
|
||||
@@ -423,7 +423,7 @@ if [[ $1 == "breach_with_spent_htlc" ]]; then
|
||||
new_blocks 3
|
||||
wait_until_channel_open alice
|
||||
echo "alice pays bob"
|
||||
invoice=$($bob add_request 0.04 --lightning -m "test" | jq -r ".lightning_invoice")
|
||||
invoice=$($bob add_request 0.04 --lightning --memo "test" | jq -r ".lightning_invoice")
|
||||
$alice lnpay $invoice --timeout=1 || true
|
||||
ctx=$($alice get_channel_ctx $channel --iknowwhatimdoing)
|
||||
unsettled=$($alice list_channels | jq '.[] | .local_unsettled_sent')
|
||||
@@ -486,11 +486,11 @@ if [[ $1 == "watchtower" ]]; then
|
||||
new_blocks 3
|
||||
wait_until_channel_open alice
|
||||
echo "alice pays bob"
|
||||
invoice1=$($bob add_request 0.01 --lightning -m "invoice1" | jq -r ".lightning_invoice")
|
||||
invoice1=$($bob add_request 0.01 --lightning --memo "invoice1" | jq -r ".lightning_invoice")
|
||||
$alice lnpay $invoice1
|
||||
ctx=$($alice get_channel_ctx $channel --iknowwhatimdoing)
|
||||
echo "alice pays bob again"
|
||||
invoice2=$($bob add_request 0.01 --lightning -m "invoice2" | jq -r ".lightning_invoice")
|
||||
invoice2=$($bob add_request 0.01 --lightning --memo "invoice2" | jq -r ".lightning_invoice")
|
||||
$alice lnpay $invoice2
|
||||
bob_ctn=$($bob list_channels | jq '.[0].local_ctn')
|
||||
msg="waiting until watchtower is synchronized"
|
||||
@@ -525,7 +525,7 @@ if [[ $1 == "fw_fail_htlc" ]]; then
|
||||
wait_until_channel_open alice
|
||||
wait_until_channel_open carol
|
||||
echo "alice pays carol"
|
||||
invoice=$($carol add_request 0.01 --lightning -m "invoice" | jq -r ".lightning_invoice")
|
||||
invoice=$($carol add_request 0.01 --lightning --memo "invoice" | jq -r ".lightning_invoice")
|
||||
screen -S alice_payment -dm -L -Logfile /tmp/alice/screen1.log $alice lnpay $invoice --timeout=600
|
||||
sleep 1
|
||||
unsettled=$($alice list_channels | jq '.[] | .local_unsettled_sent')
|
||||
@@ -561,7 +561,7 @@ if [[ $1 == "just_in_time" ]]; then
|
||||
wait_until_channel_open carol
|
||||
echo "carol pays alice"
|
||||
# note: set amount to 0.001 to test failure: 'payment too low'
|
||||
invoice=$($alice add_request 0.01 --lightning -m "invoice" | jq -r ".lightning_invoice")
|
||||
invoice=$($alice add_request 0.01 --lightning --memo "invoice" | jq -r ".lightning_invoice")
|
||||
$carol lnpay $invoice
|
||||
fi
|
||||
|
||||
|
||||
@@ -53,6 +53,8 @@ class TestCommands(ElectrumTestCase):
|
||||
self.assertTrue(eval_bool("True"))
|
||||
self.assertTrue(eval_bool("true"))
|
||||
self.assertTrue(eval_bool("1"))
|
||||
with self.assertRaises(ValueError):
|
||||
eval_bool("Falsee")
|
||||
|
||||
async def test_convert_xkey(self):
|
||||
cmds = Commands(config=self.config)
|
||||
|
||||
Reference in New Issue
Block a user