core-lightning/doc/lightning-commando.7.md
Matt Whitlock 09d52b3cb4 doc: escape more naughty underscores
The only time underscores aren't special in Markdown is when they appear
in preformatted text. We have gotten away with not escaping underscores
where an asterisk-enclosed span or the paragraph ends before the next
underscore appears, but this is fragile and bad practice. Conversely,
there are many places where we have not escaped underscores but needed
to.

Escape all underscores that do not appear in preformatted blocks or
preformatted spans and are not themselves delineating emphasized spans.

The changes in this commit are exactly the result of executing the
following Bash code:

```bash
e=':x;'           	# begin loop
e+='s/^'          	# anchor match at beginning of line
e+='('            	# begin capturing subexpression
	e+='('    	# begin list of alternatives
		e+='[^`_\\]|'        	# any mundane character, or
		e+='`([^`\\]|\\.)*`|'	# backtick-enclosed span, or
		e+='\b_|_\b|'        	# underscore at boundary, or
		e+='\\.'             	# backslash-escaped character
	e+=')*'   	# any number of the preceding alternatives
e+=')'            	# end capturing subexpression
e+='\B_\B/\1\\_/;'	# escape non-formatting underscore
e+='tx'           	# repeat loop if we escaped an underscore

escape_underscores=(
	sed

	# use extended regular expressions
	-E

	# skip over indented blocks (following an empty line)
	-e '/^$/{:i;n;/^( {4,}|\t)/bi}'

	# skip over preformatted blocks
	-e '/^\s*```/,/^\s*```/{p;d}'

	# skip over generated sections
	-e '/GENERATE-FROM-SCHEMA-START/,/GENERATE-FROM-SCHEMA-END/{p;d}'

	# escape underscores
	-e "${e}"
)

"${escape_underscores[@]}" -i doc/*.[0-9].md
```

Changelog-None
2022-12-12 15:34:00 +10:30

53 lines
1.5 KiB
Markdown

lightning-commando -- Command to Send a Command to a Remote Peer
================================================================
SYNOPSIS
--------
**commando** *peer\_id* *method* [*params*] [*rune*]
DESCRIPTION
-----------
The **commando** RPC command is a homage to bad 80s movies. It also
sends a directly-connected *peer\_id* a custom message, containing a
request to run *method* (with an optional dictionary of *params*);
generally the peer will only allow you to run a command if it has
provided you with a *rune* which allows it.
RETURN VALUE
------------
On success, the return depends on the *method* invoked.
On failure, one of the following error codes may be returned:
- -32600: Usually means peer is not connected
- 19535: the local commando plugin discovered an error.
- 19536: the remote commando plugin discovered an error.
- 19537: the remote commando plugin said we weren't authorized.
It can also fail if the peer does not respond, in which case it will simply
hang awaiting a response.
AUTHOR
------
Rusty Russell <<rusty@rustcorp.com.au>> wrote the original Python
commando.py plugin, the in-tree commando plugin, and this manual page.
Christian Decker came up with the name "commando", which almost
excuses his previous adoption of the name "Eltoo".
SEE ALSO
--------
lightning-commando-rune(7)
RESOURCES
---------
Main web site: <https://github.com/ElementsProject/lightning>
[comment]: # ( SHA256STAMP:6f4406cae30cab813b3bf4e1242af914276716a057e558474e29340665ee8c2f)