Skip to content

Commit cc1fa36

Browse files
author
Yury Bushmelev
committed
Document JSON support in Bolt CLI --targets option
This commit documents the change introduced in OpenVoxProject/openbolt#281. Signed-off-by: Yury Bushmelev <yury.bushmelev@fenix-one.com>
1 parent 4f72c78 commit cc1fa36

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

docs/_openbolt_5x/running_bolt_commands.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,18 +175,32 @@ Invoke-BoltCommand -Command 'pwd' -Targets '@targets.txt'
175175

176176
> **Note:** In PowerShell, always wrap the file name in single quotes.
177177
178+
The file can also contain a JSON array of target names or a Bolt result
179+
object with an `items` array where each item has a `target` key.
180+
178181
### Read targets from stdin
179182

180183
To read a list of targets from stdin, pipe the results from another command to
181-
Bolt and pass a single dash (`-`) to the `targets` option.
184+
Bolt and pass a single dash (`-`) to the `targets` option. Stdin accepts
185+
plain text target lists as well as JSON input. JSON input can be a JSON array
186+
of target names or a Bolt result object with an `items` array where each item
187+
has a `target` key.
182188

183189
_\*nix shell command:_
184190

185191
```console
186192
cat targets.txt | bolt command run 'pwd' --targets -
187193
```
188194

189-
Reading from stdin is not supported by the PowerShell module.
195+
Pipe JSON output from a Bolt plan to run a command on the resulting targets:
196+
197+
_\*nix shell command:_
198+
199+
```console
200+
bolt plan run myplan --format=json | bolt command run 'pwd' -t-
201+
```
202+
203+
> **Note:** Reading from stdin is not supported by the PowerShell module.
190204
191205
### Specify targets from the previous command
192206

0 commit comments

Comments
 (0)