2222 <a href="https://opensource.org/licenses/MIT" rel="nofollow">
2323 <img alt="MIT license" src="https://img.shields.io/github/license/mdm-code/tq">
2424 </a>
25- <a href="https://goreportcard.com/report/github.com/mdm-code/tq">
26- <img alt="Go report card" src="https://goreportcard.com/badge/github.com/mdm-code/tq">
25+ <a href="https://goreportcard.com/report/github.com/mdm-code/tq/v2 ">
26+ <img alt="Go report card" src="https://goreportcard.com/badge/github.com/mdm-code/tq/v2 ">
2727 </a>
2828 <a href="https://pkg.go.dev/github.com/mdm-code/tq/v2">
2929 <img alt="Go package docs" src="https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white">
@@ -137,13 +137,13 @@ to an iterator with `[]`, and then (5) query each element of the iterator for
137137
138138
139139``` sh
140- tq -q '
140+ << EOF tq -q '
141141 .runners[]
142142 .kubernetes
143143 .volumes
144144 .host_path[]
145145 ."host path"
146- ' << EOF
146+ '
147147[session_server]
148148 session_timeout = 1800
149149
@@ -190,10 +190,12 @@ tq -q '
190190 pod_annotations_overwrite_allowed = ""
191191 [runners.kubernetes.volumes]
192192EOF
193+ ```
193194
195+ ``` txt
194196Output:
195197
196- ' /home/core/data/gitlab-runner/data'
198+ /home/core/data/gitlab-runner/data
197199```
198200
199201
@@ -205,7 +207,7 @@ with `[]`, and then (3) the IP address is recovered from each of the objects
205207with the quoted key ` "ip" ` .
206208
207209``` sh
208- tq -q ' .servers[]."ip"' << EOF
210+ << EOF tq -q '.servers[]."ip"'
209211[servers]
210212
211213[servers.prod]
@@ -216,11 +218,13 @@ role = "backend"
216218ip = "10.0.0.2"
217219role = "backend"
218220EOF
221+ ```
219222
223+ ``` txt
220224Output:
221225
222- ' 10.0.0.1'
223- ' 10.0.0.2'
226+ 10.0.0.1
227+ 10.0.0.2
224228```
225229
226230
@@ -231,10 +235,12 @@ all ports aside from the first one assigned to the first database record on the
231235list.
232236
233237``` sh
234- tq -q ' .["databases"][0]["ports"][1:][]' << EOF
238+ << EOF tq -q '.["databases"][0]["ports"][1:][]'
235239databases = [ {enabled = true, ports = [ 5432, 5433, 5434 ]} ]
236240EOF
241+ ```
237242
243+ ``` txt
238244Output:
239245
2402465433
@@ -248,7 +254,7 @@ If you don't feel like installing `tq` with `go install`, you can test `tq` out
248254running inside of a container with this command:
249255
250256``` sh
251- docker run -i ghcr.io/mdm-code/tq:latest tq -q " .dependencies.ignore" << EOF
257+ << EOF docker run -i ghcr.io/mdm-code/tq:latest tq -q ".dependencies.ignore"
252258[dependencies]
253259anyhow = "1.0.75"
254260bstr = "1.7.0"
@@ -262,6 +268,13 @@ textwrap = { version = "0.16.0", default-features = false }
262268EOF
263269```
264270
271+ ``` txt
272+ Output:
273+
274+ path = 'crates/ignore'
275+ version = '0.4.22'
276+ ```
277+
265278
266279## Development
267280
0 commit comments