Tools for working with the output of commands in Cog pipelines.
format:head
- filter the output to only include the first N responsesformat:fields
- show the keys included in a command responseformat:list
- build a list of the values for a given key from each response objectformat:table
- format command response as a table. see-also:operable:table
format:tail
- filter the output to only include the last N responses
- None. All commands are set to
allow
by default.
All of the examples below will use the following seed as input. This seed command is shortened to seed ...
in the examples for the sake of brevity.
seed '[{ "name": "geddy", "role": "lead singer/bass guitar" },{ "name": "neil", "role": "drummer/lyricist" }, { "name": "alex", "role": "lead guitar" }]'
> seed ... | format:head 1
{
"name": "geddy",
"role": "lead singer/bass guitar"
}
> seed ... | format:head 1 | format:fields
name role
> seed '[{ "name": "geddy", "role": [ "bass guitar", "lead singer" ] },{ "name": "neil", "role": [ "drummer", "lyricist" ]}, { "name": "alex", "role": [ "lead guitar" ] }]' | format:list name
alex, geddy, neil
> seed ... | format:table name role
+-------+-------------------------+
| name | role |
+-------+-------------------------+
| geddy | lead singer/bass guitar |
| neil | drummer/lyricist |
| alex | lead guitar |
+-------+-------------------------+
> seed ... | format:tail 1
{
"name": "alex",
"role": "lead guitar"
}