Skip to content

Commit 73e0f87

Browse files
committed
Document the command_chain option
1 parent bf2075c commit 73e0f87

File tree

1 file changed

+34
-3
lines changed

1 file changed

+34
-3
lines changed

doc/ale.txt

+34-3
Original file line numberDiff line numberDiff line change
@@ -1005,15 +1005,40 @@ ale#linter#Define(filetype, linter) *ale#linter#Define()*
10051005
check, and will produce the lines of output given to
10061006
the `callback`.
10071007

1008-
Either this or the `command_callback` argument must
1009-
be provided.
1010-
10111008
`command_callback` A |String| or |Funcref| for a callback function
10121009
accepting a buffer number. A |String| should be
10131010
returned for a command to run. This can be used in
10141011
place of `command` when more complicated processing
10151012
is needed.
10161013

1014+
`command_chain` A |List| of |Dictionary| items defining a series
1015+
of commands to be run. At least one |Dictionary|
1016+
should be provided. Each Dictionary must contain the
1017+
key `callback`, defining a |String| or |Funcref| for
1018+
a function returning a |String| for a command to run.
1019+
1020+
The callback functions for each command after the
1021+
first command in in the chain should accept two
1022+
arguments `(buffer, output)`, a buffer number and a
1023+
|List| of lines of output from the previous command
1024+
in the chain.
1025+
1026+
The first callback function in a chain accepts only
1027+
a `(buffer)` argument, as there are no previous
1028+
commands to run which return `output`.
1029+
1030+
Commands in the chain will all use the
1031+
`output_stream` value provided in the root
1032+
|Dictionary|. Each command in the chain can also
1033+
provide an `output_stream` key to override this value.
1034+
See the `output_stream` description for more
1035+
information.
1036+
1037+
The Vim buffer being checked for linter will only
1038+
be sent to the final command in the chain. Previous
1039+
commands in the chain will receive no input from
1040+
stdin.
1041+
10171042
`output_stream` A |String| for the output stream the lines of output
10181043
should be read from for the command which is run. The
10191044
accepted values are `'stdout'`, `'stderr'`, and
@@ -1023,6 +1048,12 @@ ale#linter#Define(filetype, linter) *ale#linter#Define()*
10231048
instead of stdout. The option `'both'` will read
10241049
from both stder and stdout at the same time.
10251050

1051+
Only one of `command`, `command_callback`, or `command_chain` should be
1052+
specified. `command_callback` is generally recommended when a command string
1053+
needs to be generated dynamically, or any global options are used.
1054+
`command_chain` is recommended where any system calls need to be made to
1055+
retrieve some kind of information before running the final command.
1056+
10261057
Some programs for checking for errors are not capable of receiving input
10271058
from stdin, as is required by ALE. To remedy this, a wrapper script is
10281059
provided named in the variable |g:ale#util#stdin_wrapper|. This variable

0 commit comments

Comments
 (0)