mirror of
https://github.com/mikefarah/yq.git
synced 2026-08-24 16:39:58 +08:00
Compare commits
362
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb9181670e | ||
|
|
0cd15867d0 | ||
|
|
7ade7a97a5 | ||
|
|
668e5600c3 | ||
|
|
ae228c4b2a | ||
|
|
9949a23724 | ||
|
|
b86fb0aea0 | ||
|
|
b369de6662 | ||
|
|
75483fe908 | ||
|
|
f4e7203a55 | ||
|
|
d17fd9424e | ||
|
|
a1698b740a | ||
|
|
5cb3c876fc | ||
|
|
0f2a84d270 | ||
|
|
bbb149b31e | ||
|
|
18a51ca5b8 | ||
|
|
93b7c999be | ||
|
|
f64f73a0ce | ||
|
|
88a6b20ba5 | ||
|
|
915ab69922 | ||
|
|
f9f340b6bf | ||
|
|
75920481b1 | ||
|
|
d21bb920d6 | ||
|
|
d119dbc239 | ||
|
|
7eda4a5100 | ||
|
|
3b1bcac5b3 | ||
|
|
6d7d76a3f1 | ||
|
|
dd6cf3df14 | ||
|
|
473be23153 | ||
|
|
ec40a1a08a | ||
|
|
729ac285da | ||
|
|
3b84c03131 | ||
|
|
d7da0cca3c | ||
|
|
fcda053d73 | ||
|
|
e23c989b78 | ||
|
|
95d14cb0af | ||
|
|
00c2be541d | ||
|
|
9af55d555b | ||
|
|
ef2064c753 | ||
|
|
18cdea3f88 | ||
|
|
36e0194e42 | ||
|
|
87cba2ecbe | ||
|
|
8d8e7c3b2c | ||
|
|
48d00f807e | ||
|
|
481ea64ccc | ||
|
|
f6a48b6899 | ||
|
|
8e5290d7c5 | ||
|
|
83c5e1bc83 | ||
|
|
8df8d89c6d | ||
|
|
226f1c1a9b | ||
|
|
bb3f3e541d | ||
|
|
42e7c3cdf0 | ||
|
|
f9a8ba91e4 | ||
|
|
1617e5de19 | ||
|
|
77998d1bb3 | ||
|
|
68f47c02c8 | ||
|
|
02be2b2918 | ||
|
|
43233ce62e | ||
|
|
51043770bf | ||
|
|
4478bd14c9 | ||
|
|
91dc315fdb | ||
|
|
a6d1a52e33 | ||
|
|
fd35530f35 | ||
|
|
cb609a1886 | ||
|
|
b202ccc5dc | ||
|
|
ee226b47fc | ||
|
|
9edff1f22c | ||
|
|
67864ffdab | ||
|
|
b55381f34e | ||
|
|
b6ad314dbb | ||
|
|
762f46ed54 | ||
|
|
63db5de4e2 | ||
|
|
9606957a0e | ||
|
|
e02bb71948 | ||
|
|
1fd96e168e | ||
|
|
ffc20f7e2c | ||
|
|
3e795d020d | ||
|
|
88ce6ffcbe | ||
|
|
83ef7ee5cf | ||
|
|
817287ec90 | ||
|
|
c5994a8b28 | ||
|
|
3435fee1f9 | ||
|
|
ececd00fbd | ||
|
|
46dbd0c859 | ||
|
|
cad809515c | ||
|
|
1d35134310 | ||
|
|
fae1dbf0be | ||
|
|
04847502bf | ||
|
|
af7e36bd47 | ||
|
|
fdad478684 | ||
|
|
22f376bbfd | ||
|
|
688fe55bb9 | ||
|
|
91b3fb2af3 | ||
|
|
bd5e5dc965 | ||
|
|
c915113120 | ||
|
|
cf02b90624 | ||
|
|
7f5dda93c6 | ||
|
|
a0be871a9d | ||
|
|
5af062a86f | ||
|
|
ed551bf339 | ||
|
|
5e490527de | ||
|
|
c887042a1b | ||
|
|
0cc5e75432 | ||
|
|
6d6cd43255 | ||
|
|
d99614f55a | ||
|
|
880397d549 | ||
|
|
46c32f4c79 | ||
|
|
b25114c1fc | ||
|
|
44552c151b | ||
|
|
108cfeb4bb | ||
|
|
24bbffd71e | ||
|
|
c62e18f9b2 | ||
|
|
c1640fb10d | ||
|
|
0c33690596 | ||
|
|
6bf3defe85 | ||
|
|
6d6b693fb3 | ||
|
|
14f827b9b7 | ||
|
|
eac988abdc | ||
|
|
ea4a50f6e9 | ||
|
|
6c94869329 | ||
|
|
5ef9101913 | ||
|
|
1f0881fb5f | ||
|
|
600e132fb6 | ||
|
|
f571b163e5 | ||
|
|
0b235b367d | ||
|
|
a264833c06 | ||
|
|
22c44d3ecb | ||
|
|
8ed817916f | ||
|
|
cb4c41eebf | ||
|
|
ecc490a0fa | ||
|
|
8a45e02cbb | ||
|
|
28a6c9c532 | ||
|
|
dee0c94346 | ||
|
|
780ae29c2b | ||
|
|
9ca20451b7 | ||
|
|
6db7acbf69 | ||
|
|
d16ee386d2 | ||
|
|
c3f4bb8156 | ||
|
|
c640888133 | ||
|
|
33ec66cfdd | ||
|
|
1b8d399de4 | ||
|
|
48c36efe07 | ||
|
|
f27a3c5c92 | ||
|
|
ffe635f943 | ||
|
|
b5b81abb90 | ||
|
|
da3f3b93b4 | ||
|
|
7f4c8e1c78 | ||
|
|
60f30f8a48 | ||
|
|
2362451fda | ||
|
|
55a7fdfd8a | ||
|
|
3dd5f0c80c | ||
|
|
be304a1102 | ||
|
|
a4b60039ca | ||
|
|
b20477210f | ||
|
|
9b6961875e | ||
|
|
51b64e6cf3 | ||
|
|
851d93e5a8 | ||
|
|
9291865eed | ||
|
|
fb330ebcb0 | ||
|
|
ae7a48df2d | ||
|
|
2e3c50c535 | ||
|
|
a64eea3b1a | ||
|
|
a12c1a6610 | ||
|
|
bf6b4d3941 | ||
|
|
3d11b0545d | ||
|
|
b4ca184108 | ||
|
|
b1a40a9fb7 | ||
|
|
187d9523c6 | ||
|
|
a44938101d | ||
|
|
a4634cdc86 | ||
|
|
a696dceea4 | ||
|
|
989dabac5a | ||
|
|
8eac186a35 | ||
|
|
1c7dc0e88a | ||
|
|
2c9b5be408 | ||
|
|
a91a8ccc66 | ||
|
|
6dfef716d7 | ||
|
|
06a2b9d426 | ||
|
|
6cd0892d59 | ||
|
|
51b3985aa0 | ||
|
|
c8815f5ab9 | ||
|
|
3c222d8707 | ||
|
|
4508bc2dc2 | ||
|
|
8c3a8c085e | ||
|
|
b9a1ef89fe | ||
|
|
c2c48bbe1d | ||
|
|
97f89c0edb | ||
|
|
03ba38eaff | ||
|
|
f393cf37c2 | ||
|
|
f3a8c4b2ec | ||
|
|
86c2b03630 | ||
|
|
98b411f82e | ||
|
|
06d2aaad80 | ||
|
|
9b47a29864 | ||
|
|
b669844ef7 | ||
|
|
ad4e7c9d8a | ||
|
|
c5f83e4730 | ||
|
|
be05df03b5 | ||
|
|
c7c11ef68b | ||
|
|
7fe937c61e | ||
|
|
dfd396b480 | ||
|
|
f63d76f006 | ||
|
|
2bc7dcfcca | ||
|
|
60c037f57e | ||
|
|
b9309a42a4 | ||
|
|
98193a7a9d | ||
|
|
8d3be1a23c | ||
|
|
70403375d7 | ||
|
|
9eaec6f0f5 | ||
|
|
439bcaad25 | ||
|
|
294da55012 | ||
|
|
8d32e6a82c | ||
|
|
1e27e39927 | ||
|
|
5126f3dfee | ||
|
|
6bce23d9c2 | ||
|
|
dee592eb3b | ||
|
|
451d8643ee | ||
|
|
fbe49c3700 | ||
|
|
7d28e4e0de | ||
|
|
9f0f29f0fc | ||
|
|
3c46c9ff1e | ||
|
|
c05995b301 | ||
|
|
72cdde78f6 | ||
|
|
1aeb8e3025 | ||
|
|
689c535a29 | ||
|
|
1425d0720e | ||
|
|
55c5497fab | ||
|
|
67c79b7cb1 | ||
|
|
26529fae94 | ||
|
|
70ad7a35a8 | ||
|
|
90261a2fdd | ||
|
|
3ad5355777 | ||
|
|
ed5b811f37 | ||
|
|
22a2ccfdf4 | ||
|
|
691e52e408 | ||
|
|
b11075ec98 | ||
|
|
ea66a73f43 | ||
|
|
6f9f80cc48 | ||
|
|
13a27e8b2d | ||
|
|
bcff465f11 | ||
|
|
270d8bd51a | ||
|
|
2ef367b2b0 | ||
|
|
454e563a0e | ||
|
|
217744bc9a | ||
|
|
34ffb94d98 | ||
|
|
6f4702a230 | ||
|
|
b1f77d975e | ||
|
|
523b8335d8 | ||
|
|
5d225b9454 | ||
|
|
0956eefb1a | ||
|
|
a9ed08a5f8 | ||
|
|
ae71824adc | ||
|
|
186b319093 | ||
|
|
bc2118736b | ||
|
|
1780027421 | ||
|
|
3cd999bb87 | ||
|
|
bbeae229ca | ||
|
|
3a1e2c7518 | ||
|
|
fb148c305a | ||
|
|
897604142f | ||
|
|
03f57b7034 | ||
|
|
005b097cee | ||
|
|
e08b6803f5 | ||
|
|
78e9cc7998 | ||
|
|
1a964c5055 | ||
|
|
0ffee92175 | ||
|
|
99cd9e8aae | ||
|
|
8cb2422b57 | ||
|
|
4bb2fa1652 | ||
|
|
d27fb0ec78 | ||
|
|
406bbb8ca4 | ||
|
|
3924ed8a35 | ||
|
|
b1fee26a7f | ||
|
|
58be9829f9 | ||
|
|
33a29817d7 | ||
|
|
edbdb16ab7 | ||
|
|
2e731c310f | ||
|
|
79f2e1558c | ||
|
|
f0b37ea06d | ||
|
|
8698433d44 | ||
|
|
ff047d0748 | ||
|
|
6c220d4562 | ||
|
|
0e0183b9ea | ||
|
|
61978b34df | ||
|
|
d9bca65626 | ||
|
|
d7b158f855 | ||
|
|
71706af3d4 | ||
|
|
8142e94349 | ||
|
|
2752544bc8 | ||
|
|
558a18029a | ||
|
|
665f6b0267 | ||
|
|
fc447b46ce | ||
|
|
304fc462a4 | ||
|
|
75fffc17e1 | ||
|
|
e1b5e90adf | ||
|
|
6374098cdc | ||
|
|
b35893d783 | ||
|
|
4b2b47af48 | ||
|
|
a5f6a80cf6 | ||
|
|
a9c3617b4f | ||
|
|
4d4bd5114d | ||
|
|
bfaafa66f9 | ||
|
|
26356ff4be | ||
|
|
06e944dcb6 | ||
|
|
2891c6948d | ||
|
|
703418d0c4 | ||
|
|
75960c6484 | ||
|
|
5ac3c57510 | ||
|
|
926a68181b | ||
|
|
1f367ac200 | ||
|
|
de38abb121 | ||
|
|
d00153de71 | ||
|
|
992fe066aa | ||
|
|
b80080a26d | ||
|
|
0afb59c65e | ||
|
|
535799462f | ||
|
|
77204551ab | ||
|
|
772d369058 | ||
|
|
9b7c80a76b | ||
|
|
a6fc7aa881 | ||
|
|
6f27cb93d1 | ||
|
|
b2a93930d0 | ||
|
|
dedd1ca892 | ||
|
|
01b4917f26 | ||
|
|
25e374f4ee | ||
|
|
3ba728d40c | ||
|
|
8761920f58 | ||
|
|
394be5c65a | ||
|
|
4ec533bc1b | ||
|
|
fc276ff450 | ||
|
|
c3d815998a | ||
|
|
71242b0c8e | ||
|
|
a9e7f669d0 | ||
|
|
8195ff8b9b | ||
|
|
9b1a7bf451 | ||
|
|
9b66e0a094 | ||
|
|
6e33132de9 | ||
|
|
a6c79f3410 | ||
|
|
50df792e49 | ||
|
|
6f24e878aa | ||
|
|
a0ba208669 | ||
|
|
d5b0154747 | ||
|
|
7d2ddc1cde | ||
|
|
02252e8e69 | ||
|
|
2526b03d67 | ||
|
|
e347090571 | ||
|
|
f8bcaca4c9 | ||
|
|
de0716e875 | ||
|
|
21cdbab0d7 | ||
|
|
1fba46f2f7 | ||
|
|
dfe4308304 | ||
|
|
8c94a96ee0 | ||
|
|
ec8ef312ef | ||
|
|
606ef91cc6 | ||
|
|
78b45a3eb0 | ||
|
|
84ddf1862f | ||
|
|
2d7c63e4e4 | ||
|
|
eac75f7dad | ||
|
|
5e30f3ba90 | ||
|
|
0b49bebad9 | ||
|
|
c48b1612df | ||
|
|
6763ae6e7b |
@@ -26,7 +26,7 @@ country: Australia
|
|||||||
And we run a command:
|
And we run a command:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
yq eval 'predictWeatherOf(.country)'
|
yq 'predictWeatherOf(.country)'
|
||||||
```
|
```
|
||||||
|
|
||||||
it could output
|
it could output
|
||||||
|
|||||||
@@ -0,0 +1,70 @@
|
|||||||
|
# For most projects, this workflow file will not need changing; you simply need
|
||||||
|
# to commit it to your repository.
|
||||||
|
#
|
||||||
|
# You may wish to alter this file to override the set of languages analyzed,
|
||||||
|
# or to provide custom queries or build logic.
|
||||||
|
#
|
||||||
|
# ******** NOTE ********
|
||||||
|
# We have attempted to detect the languages in your repository. Please check
|
||||||
|
# the `language` matrix defined below to confirm you have the correct set of
|
||||||
|
# supported CodeQL languages.
|
||||||
|
#
|
||||||
|
name: "CodeQL"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ master ]
|
||||||
|
pull_request:
|
||||||
|
# The branches below must be a subset of the branches above
|
||||||
|
branches: [ master ]
|
||||||
|
schedule:
|
||||||
|
- cron: '24 3 * * 1'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
analyze:
|
||||||
|
name: Analyze
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
actions: read
|
||||||
|
contents: read
|
||||||
|
security-events: write
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
language: [ 'go' ]
|
||||||
|
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
|
||||||
|
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
# Initializes the CodeQL tools for scanning.
|
||||||
|
- name: Initialize CodeQL
|
||||||
|
uses: github/codeql-action/init@v2
|
||||||
|
with:
|
||||||
|
languages: ${{ matrix.language }}
|
||||||
|
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||||
|
# By default, queries listed here will override any specified in a config file.
|
||||||
|
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||||
|
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
||||||
|
|
||||||
|
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||||
|
# If this step fails, then you should remove it and run the build manually (see below)
|
||||||
|
- name: Autobuild
|
||||||
|
uses: github/codeql-action/autobuild@v2
|
||||||
|
|
||||||
|
# ℹ️ Command-line programs to run using the OS shell.
|
||||||
|
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
||||||
|
|
||||||
|
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||||
|
# and modify them (or add more) to build your code if your project
|
||||||
|
# uses a compiled language
|
||||||
|
|
||||||
|
#- run: |
|
||||||
|
# make bootstrap
|
||||||
|
# make release
|
||||||
|
|
||||||
|
- name: Perform CodeQL Analysis
|
||||||
|
uses: github/codeql-action/analyze@v2
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
name: Release Docker
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [released]
|
||||||
|
|
||||||
|
# Allows you to run this workflow manually from the Actions tab
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publishDocker:
|
||||||
|
environment: dockerhub
|
||||||
|
env:
|
||||||
|
IMAGE_NAME: mikefarah/yq
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v2
|
||||||
|
with:
|
||||||
|
platforms: all
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
id: buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
with:
|
||||||
|
version: latest
|
||||||
|
|
||||||
|
- name: Available platforms
|
||||||
|
run: echo ${{ steps.buildx.outputs.platforms }} && docker version
|
||||||
|
|
||||||
|
- name: Build and push image
|
||||||
|
run: |
|
||||||
|
echo "GithubRef: ${GITHUB_REF}"
|
||||||
|
VERSION=${GITHUB_REF##*/}
|
||||||
|
echo "VERSION: ${VERSION}"
|
||||||
|
IMAGE_VERSION=${VERSION:1}
|
||||||
|
echo "IMAGE_VERSION: ${IMAGE_VERSION}"
|
||||||
|
|
||||||
|
PLATFORMS="linux/amd64,linux/ppc64le,linux/arm64"
|
||||||
|
|
||||||
|
echo "Building and pushing version ${IMAGE_VERSION} of image ${IMAGE_NAME}"
|
||||||
|
echo '${{ secrets.DOCKER_PASSWORD }}' | docker login -u '${{ secrets.DOCKER_USERNAME }}' --password-stdin
|
||||||
|
docker buildx build \
|
||||||
|
--label "org.opencontainers.image.authors=https://github.com/mikefarah/yq/graphs/contributors" \
|
||||||
|
--label "org.opencontainers.image.created=$(date --rfc-3339=seconds)" \
|
||||||
|
--label "org.opencontainers.image.description=yq is a portable command-line YAML processor" \
|
||||||
|
--label "org.opencontainers.image.documentation=https://mikefarah.gitbook.io/yq/" \
|
||||||
|
--label "org.opencontainers.image.licenses=MIT" \
|
||||||
|
--label "org.opencontainers.image.revision=$(git rev-parse HEAD)" \
|
||||||
|
--label "org.opencontainers.image.source=https://github.com/mikefarah/yq" \
|
||||||
|
--label "org.opencontainers.image.title=yq" \
|
||||||
|
--label "org.opencontainers.image.url=https://mikefarah.gitbook.io/yq/" \
|
||||||
|
--label "org.opencontainers.image.version=${IMAGE_VERSION}" \
|
||||||
|
--platform "${PLATFORMS}" \
|
||||||
|
--pull \
|
||||||
|
--push \
|
||||||
|
-t "${IMAGE_NAME}:${IMAGE_VERSION}" \
|
||||||
|
-t "${IMAGE_NAME}:4" \
|
||||||
|
-t "${IMAGE_NAME}:latest" \
|
||||||
|
.
|
||||||
|
|
||||||
|
cd github-action
|
||||||
|
docker buildx build \
|
||||||
|
--label "org.opencontainers.image.authors=https://github.com/mikefarah/yq/graphs/contributors" \
|
||||||
|
--label "org.opencontainers.image.created=$(date --rfc-3339=seconds)" \
|
||||||
|
--label "org.opencontainers.image.description=yq is a portable command-line YAML processor" \
|
||||||
|
--label "org.opencontainers.image.documentation=https://mikefarah.gitbook.io/yq/" \
|
||||||
|
--label "org.opencontainers.image.licenses=MIT" \
|
||||||
|
--label "org.opencontainers.image.revision=$(git rev-parse HEAD)" \
|
||||||
|
--label "org.opencontainers.image.source=https://github.com/mikefarah/yq" \
|
||||||
|
--label "org.opencontainers.image.title=yq" \
|
||||||
|
--label "org.opencontainers.image.url=https://mikefarah.gitbook.io/yq/" \
|
||||||
|
--label "org.opencontainers.image.version=${IMAGE_VERSION}" \
|
||||||
|
--platform "${PLATFORMS}" \
|
||||||
|
--pull \
|
||||||
|
--push \
|
||||||
|
-t "${IMAGE_NAME}:${IMAGE_VERSION}-githubaction" \
|
||||||
|
-t "${IMAGE_NAME}:4-githubaction" \
|
||||||
|
-t "${IMAGE_NAME}:latest-githubaction" \
|
||||||
|
.
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
name: Build
|
name: Build
|
||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
build:
|
build:
|
||||||
@@ -7,14 +10,14 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: Set up Go 1.17
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v2
|
uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
go-version: 1.17
|
go-version: '^1.20'
|
||||||
id: go
|
id: go
|
||||||
|
|
||||||
- name: Check out code into the Go module directory
|
- name: Check out code into the Go module directory
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Get dependencies
|
- name: Get dependencies
|
||||||
run: |
|
run: |
|
||||||
@@ -25,6 +28,7 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Check the build
|
- name: Check the build
|
||||||
|
shell: bash -l {0}
|
||||||
run: |
|
run: |
|
||||||
export PATH=${PATH}:`go env GOPATH`/bin
|
export PATH=${PATH}:`go env GOPATH`/bin
|
||||||
scripts/devtools.sh
|
scripts/devtools.sh
|
||||||
|
|||||||
@@ -3,24 +3,25 @@ on:
|
|||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- 'v*'
|
- 'v*'
|
||||||
|
- 'draft-*'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
publishGitRelease:
|
publishGitRelease:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-go@v2
|
- uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
go-version: '^1.17.5'
|
go-version: '^1.20'
|
||||||
|
check-latest: true
|
||||||
- name: Compile man page markup
|
- name: Compile man page markup
|
||||||
id: gen-man-page-md
|
id: gen-man-page-md
|
||||||
run: |
|
run: |
|
||||||
./scripts/generate-man-page-md.sh
|
./scripts/generate-man-page-md.sh
|
||||||
echo "::set-output name=man-page-md::man.md"
|
|
||||||
|
|
||||||
- name: Get the version
|
- name: Get the version
|
||||||
id: get_version
|
id: get_version
|
||||||
run: echo ::set-output name=VERSION::${GITHUB_REF##*/}
|
run: echo "VERSION=${GITHUB_REF##*/}" >> "${GITHUB_OUTPUT}"
|
||||||
|
|
||||||
- name: Generate man page
|
- name: Generate man page
|
||||||
uses: docker://pandoc/core:2.14.2
|
uses: docker://pandoc/core:2.14.2
|
||||||
@@ -34,77 +35,19 @@ jobs:
|
|||||||
--variable=header:"yq (https://github.com/mikefarah/yq/) version ${{ steps.get_version.outputs.VERSION }}"
|
--variable=header:"yq (https://github.com/mikefarah/yq/) version ${{ steps.get_version.outputs.VERSION }}"
|
||||||
--variable=author:"Mike Farah"
|
--variable=author:"Mike Farah"
|
||||||
--output=yq.1
|
--output=yq.1
|
||||||
${{ steps.gen-man-page-md.outputs.man-page-md }}
|
man.md
|
||||||
|
|
||||||
- name: Cross compile
|
- name: Cross compile
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get install rhash -y
|
sudo apt-get install rhash -y
|
||||||
go get github.com/mitchellh/gox
|
go install github.com/mitchellh/gox@v1.0.1
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
cp yq.1 build/yq.1
|
cp yq.1 build/yq.1
|
||||||
./scripts/xcompile.sh
|
./scripts/xcompile.sh
|
||||||
|
|
||||||
- name: Create Release
|
- name: Release
|
||||||
id: create_release
|
uses: softprops/action-gh-release@v1
|
||||||
uses: actions/create-release@v1.1.4
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
with:
|
||||||
tag_name: ${{ github.ref }}
|
files: build/*
|
||||||
release_name: ${{ github.ref }}
|
|
||||||
draft: true
|
draft: true
|
||||||
prerelease: false
|
fail_on_unmatched_files: true
|
||||||
|
|
||||||
- uses: shogo82148/actions-upload-release-asset@v1
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
||||||
asset_path: build/*
|
|
||||||
|
|
||||||
publishDocker:
|
|
||||||
environment: dockerhub
|
|
||||||
env:
|
|
||||||
IMAGE_NAME: mikefarah/yq
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v1
|
|
||||||
with:
|
|
||||||
platforms: all
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
id: buildx
|
|
||||||
uses: docker/setup-buildx-action@v1
|
|
||||||
with:
|
|
||||||
version: latest
|
|
||||||
|
|
||||||
- name: Available platforms
|
|
||||||
run: echo ${{ steps.buildx.outputs.platforms }} && docker version
|
|
||||||
|
|
||||||
- name: Build and push image
|
|
||||||
run: |
|
|
||||||
IMAGE_V_VERSION="$(git describe --tags --abbrev=0)"
|
|
||||||
IMAGE_VERSION=${IMAGE_V_VERSION:1}
|
|
||||||
PLATFORMS="linux/amd64,linux/ppc64le,linux/arm64"
|
|
||||||
|
|
||||||
echo "Building and pushing version ${IMAGE_VERSION} of image ${IMAGE_NAME}"
|
|
||||||
echo '${{ secrets.DOCKER_PASSWORD }}' | docker login -u '${{ secrets.DOCKER_USERNAME }}' --password-stdin
|
|
||||||
docker buildx build \
|
|
||||||
--label "org.opencontainers.image.authors=https://github.com/mikefarah/yq/graphs/contributors" \
|
|
||||||
--label "org.opencontainers.image.created=$(date --rfc-3339=seconds)" \
|
|
||||||
--label "org.opencontainers.image.description=yq is a portable command-line YAML processor" \
|
|
||||||
--label "org.opencontainers.image.documentation=https://mikefarah.gitbook.io/yq/" \
|
|
||||||
--label "org.opencontainers.image.licenses=MIT" \
|
|
||||||
--label "org.opencontainers.image.revision=$(git rev-parse HEAD)" \
|
|
||||||
--label "org.opencontainers.image.source=https://github.com/mikefarah/yq" \
|
|
||||||
--label "org.opencontainers.image.title=yq" \
|
|
||||||
--label "org.opencontainers.image.url=https://mikefarah.gitbook.io/yq/" \
|
|
||||||
--label "org.opencontainers.image.version=${IMAGE_VERSION}" \
|
|
||||||
--platform "${PLATFORMS}" \
|
|
||||||
--pull \
|
|
||||||
--push \
|
|
||||||
-t "${IMAGE_NAME}:${IMAGE_VERSION}" \
|
|
||||||
-t "${IMAGE_NAME}:4" \
|
|
||||||
-t "${IMAGE_NAME}:latest" \
|
|
||||||
.
|
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
name: Release Snap
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [released]
|
||||||
|
|
||||||
|
# Allows you to run this workflow manually from the Actions tab
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
buildSnap:
|
||||||
|
environment: snap
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: snapcore/action-build@v1
|
||||||
|
id: build
|
||||||
|
- uses: snapcore/action-publish@v1
|
||||||
|
env:
|
||||||
|
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.STORE_LOGIN }}
|
||||||
|
with:
|
||||||
|
snap: ${{ steps.build.outputs.snap }}
|
||||||
|
release: stable
|
||||||
@@ -1,5 +1,11 @@
|
|||||||
name: Test Yq Action
|
name: Test Yq Action
|
||||||
on: [push]
|
on:
|
||||||
|
push:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
build:
|
build:
|
||||||
@@ -7,13 +13,16 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- name: Get test
|
- name: Get test
|
||||||
|
id: get_value
|
||||||
uses: mikefarah/yq@master
|
uses: mikefarah/yq@master
|
||||||
with:
|
with:
|
||||||
cmd: yq eval '.a' examples/sample.yaml
|
cmd: yq '.test' examples/multiline-text.yaml
|
||||||
|
- name: Multiline test
|
||||||
|
run: echo "### It was [${{ steps.get_value.outputs.result }}]" >> $GITHUB_STEP_SUMMARY
|
||||||
- name: Write inplace test
|
- name: Write inplace test
|
||||||
id: lookupSdkVersion
|
id: lookupSdkVersion
|
||||||
uses: mikefarah/yq@master
|
uses: mikefarah/yq@master
|
||||||
with:
|
with:
|
||||||
cmd: yq eval -i '.b.c = 5' examples/sample.yaml
|
cmd: yq -i '.b.c = 5' examples/sample.yaml
|
||||||
+14
-1
@@ -41,6 +41,7 @@ yq*.snap
|
|||||||
|
|
||||||
test.yml
|
test.yml
|
||||||
test*.yml
|
test*.yml
|
||||||
|
test*.yaml
|
||||||
0.yml
|
0.yml
|
||||||
1.yml
|
1.yml
|
||||||
2.yml
|
2.yml
|
||||||
@@ -48,4 +49,16 @@ test*.yml
|
|||||||
|
|
||||||
# man page
|
# man page
|
||||||
man.md
|
man.md
|
||||||
yq.1
|
yq.1
|
||||||
|
|
||||||
|
# debian pkg
|
||||||
|
_build
|
||||||
|
debian/files
|
||||||
|
|
||||||
|
# intellij
|
||||||
|
/.idea
|
||||||
|
|
||||||
|
# vscode
|
||||||
|
.vscode
|
||||||
|
|
||||||
|
yq3
|
||||||
|
|||||||
@@ -18,6 +18,14 @@ linters:
|
|||||||
- revive
|
- revive
|
||||||
- unconvert
|
- unconvert
|
||||||
- unparam
|
- unparam
|
||||||
|
linters-settings:
|
||||||
|
depguard:
|
||||||
|
list-type: blacklist
|
||||||
|
include-go-root: true
|
||||||
|
packages:
|
||||||
|
- io/ioutil
|
||||||
|
packages-with-error-message:
|
||||||
|
- io/ioutil: "The 'io/ioutil' package is deprecated. Use corresponding 'os' or 'io' functions instead."
|
||||||
issues:
|
issues:
|
||||||
exclude-rules:
|
exclude-rules:
|
||||||
- linters:
|
- linters:
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
# Development
|
||||||
|
|
||||||
1. Install (golang)[https://golang.org/]
|
1. Install (golang)[https://golang.org/]
|
||||||
1. Run `scripts/devtools.sh` to install the required devtools
|
1. Run `scripts/devtools.sh` to install the required devtools
|
||||||
2. Run `make [local] vendor` to install the vendor dependencies
|
2. Run `make [local] vendor` to install the vendor dependencies
|
||||||
@@ -6,3 +8,33 @@
|
|||||||
4. Make the code changes.
|
4. Make the code changes.
|
||||||
5. `make [local] test` to lint code and run tests
|
5. `make [local] test` to lint code and run tests
|
||||||
6. Profit! ok no profit, but raise a PR and get kudos :)
|
6. Profit! ok no profit, but raise a PR and get kudos :)
|
||||||
|
|
||||||
|
|
||||||
|
# Documentation
|
||||||
|
|
||||||
|
The documentation is a bit of a mixed bag (sorry in advanced, I do plan on simplifying it...) - with some parts automatically generated and stiched together and some statically defined.
|
||||||
|
|
||||||
|
Documentation is written in markdown, and is published in the 'gitbook' branch.
|
||||||
|
|
||||||
|
The various operator documentation (e.g. 'strings') are generated from the 'master' branch, and have a statically defined header (e.g. `pkg/yqlib/doc/operators/headers/add.md`) and the bulk of the docs are generated from the unit tests e.g. `pkg/yqlib/operator_add_test.go`.
|
||||||
|
|
||||||
|
The pipeline will run the tests and automatically concatenate the files together, and put them under
|
||||||
|
`pkg/qylib/doc/add.md`. These files are checked in the master branch (and are copied to the gitbook branch as part of the release process).
|
||||||
|
|
||||||
|
## How to contribute
|
||||||
|
|
||||||
|
The first step is to find if what you want is automatically generated or not - start by looking in the master branch.
|
||||||
|
|
||||||
|
### Updating dynamic documentation from master
|
||||||
|
- Search for the documentation you want to update. If you find matches in a `*_test.go` file - update that, as that will automatically update the matching `*.md` file
|
||||||
|
- Assuming you are updating a `*_test.go` file, once updated, run the test to regenerated the docs. E.g. for the 'Add' test generated docs, from the pkg/yqlib folder run:
|
||||||
|
`go test -run TestAddOperatorScenarios` which will run that test defined in the `operator_add_test.go` file.
|
||||||
|
- Ensure the tests still pass, and check the generated documentation have your update.
|
||||||
|
- Note: If the documentation is only in a `headers/*.md` file, then just update that directly
|
||||||
|
- Raise a PR to merge the changes into master!
|
||||||
|
|
||||||
|
### Updating static documentation from the gitbook branch
|
||||||
|
If you haven't found what you want to update in the master branch, then check the gitbook branch directly as there are a few pages in there that are not in master.
|
||||||
|
|
||||||
|
- Update the `*.md` files
|
||||||
|
- Raise a PR to merge the changes into gitbook.
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
FROM golang:1.17 as builder
|
FROM golang:1.20.1 as builder
|
||||||
|
|
||||||
WORKDIR /go/src/mikefarah/yq
|
WORKDIR /go/src/mikefarah/yq
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
FROM golang:1.17
|
FROM golang:1.20.1
|
||||||
|
|
||||||
COPY scripts/devtools.sh /opt/devtools.sh
|
COPY scripts/devtools.sh /opt/devtools.sh
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
# yq
|
# yq
|
||||||
|
|
||||||
   
|
    
|
||||||
|
|
||||||
|
|
||||||
a lightweight and portable command-line YAML processor. `yq` uses [jq](https://github.com/stedolan/jq) like syntax but works with yaml files as well as json. It doesn't yet support everything `jq` does - but it does support the most common operations and functions, and more is being added continuously.
|
a lightweight and portable command-line YAML, JSON and XML processor. `yq` uses [jq](https://github.com/stedolan/jq) like syntax but works with yaml files as well as json, xml, properties, csv and tsv. It doesn't yet support everything `jq` does - but it does support the most common operations and functions, and more is being added continuously.
|
||||||
|
|
||||||
yq is written in go - so you can download a dependency free binary for your platform and you are good to go! If you prefer there are a variety of package managers that can be used as well as Docker and Podman, all listed below.
|
yq is written in go - so you can download a dependency free binary for your platform and you are good to go! If you prefer there are a variety of package managers that can be used as well as Docker and Podman, all listed below.
|
||||||
|
|
||||||
@@ -11,46 +11,58 @@ yq is written in go - so you can download a dependency free binary for your plat
|
|||||||
|
|
||||||
Read a value:
|
Read a value:
|
||||||
```bash
|
```bash
|
||||||
yq e '.a.b[0].c' file.yaml
|
yq '.a.b[0].c' file.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
Pipe from STDIN:
|
Pipe from STDIN:
|
||||||
```bash
|
```bash
|
||||||
cat file.yaml | yq e '.a.b[0].c' -
|
yq '.a.b[0].c' < file.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
Update a yaml file, inplace
|
Update a yaml file, inplace
|
||||||
```bash
|
```bash
|
||||||
yq e -i '.a.b[0].c = "cool"' file.yaml
|
yq -i '.a.b[0].c = "cool"' file.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
Update using environment variables
|
Update using environment variables
|
||||||
```bash
|
```bash
|
||||||
NAME=mike yq e -i '.a.b[0].c = strenv(NAME)' file.yaml
|
NAME=mike yq -i '.a.b[0].c = strenv(NAME)' file.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
Merge multiple files
|
Merge multiple files
|
||||||
```
|
```bash
|
||||||
|
# note the use of `ea` to evaluate all the files at once
|
||||||
|
# instead of in sequence
|
||||||
yq ea '. as $item ireduce ({}; . * $item )' path/to/*.yml
|
yq ea '. as $item ireduce ({}; . * $item )' path/to/*.yml
|
||||||
```
|
```
|
||||||
|
|
||||||
Multiple updates to a yaml file
|
Multiple updates to a yaml file
|
||||||
```bash
|
```bash
|
||||||
yq e -i '
|
yq -i '
|
||||||
.a.b[0].c = "cool" |
|
.a.b[0].c = "cool" |
|
||||||
.x.y.z = "foobar" |
|
.x.y.z = "foobar" |
|
||||||
.person.name = strenv(NAME)
|
.person.name = strenv(NAME)
|
||||||
' file.yaml
|
' file.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
See the [documentation](https://mikefarah.gitbook.io/yq/) for more.
|
Convert JSON to YAML
|
||||||
|
```bash
|
||||||
|
yq -P sample.json
|
||||||
|
```
|
||||||
|
|
||||||
|
See the [documentation](https://mikefarah.gitbook.io/yq/) for more examples.
|
||||||
|
|
||||||
|
Take a look at the discussions for [common questions](https://github.com/mikefarah/yq/discussions/categories/q-a), and [cool ideas](https://github.com/mikefarah/yq/discussions/categories/show-and-tell)
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
### [Download the latest binary](https://github.com/mikefarah/yq/releases/latest)
|
### [Download the latest binary](https://github.com/mikefarah/yq/releases/latest)
|
||||||
|
|
||||||
### wget
|
### wget
|
||||||
Use wget to download the pre-compiled binaries:
|
Use wget to download, gzipped pre-compiled binaries:
|
||||||
|
|
||||||
|
|
||||||
|
For instance, VERSION=v4.2.0 and BINARY=yq_linux_amd64
|
||||||
|
|
||||||
#### Compressed via tar.gz
|
#### Compressed via tar.gz
|
||||||
```bash
|
```bash
|
||||||
@@ -65,7 +77,12 @@ wget https://github.com/mikefarah/yq/releases/download/${VERSION}/${BINARY} -O /
|
|||||||
chmod +x /usr/bin/yq
|
chmod +x /usr/bin/yq
|
||||||
```
|
```
|
||||||
|
|
||||||
For instance, VERSION=v4.2.0 and BINARY=yq_linux_amd64
|
#### Latest version
|
||||||
|
|
||||||
|
```bash
|
||||||
|
wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq &&\
|
||||||
|
chmod +x /usr/bin/yq
|
||||||
|
```
|
||||||
|
|
||||||
### MacOS / Linux via Homebrew:
|
### MacOS / Linux via Homebrew:
|
||||||
Using [Homebrew](https://brew.sh/)
|
Using [Homebrew](https://brew.sh/)
|
||||||
@@ -82,30 +99,32 @@ snap install yq
|
|||||||
`yq` installs with [_strict confinement_](https://docs.snapcraft.io/snap-confinement/6233) in snap, this means it doesn't have direct access to root files. To read root files you can:
|
`yq` installs with [_strict confinement_](https://docs.snapcraft.io/snap-confinement/6233) in snap, this means it doesn't have direct access to root files. To read root files you can:
|
||||||
|
|
||||||
```
|
```
|
||||||
sudo cat /etc/myfile | yq e '.a.path' -
|
sudo cat /etc/myfile | yq '.a.path'
|
||||||
```
|
```
|
||||||
|
|
||||||
And to write to a root file you can either use [sponge](https://linux.die.net/man/1/sponge):
|
And to write to a root file you can either use [sponge](https://linux.die.net/man/1/sponge):
|
||||||
```
|
```
|
||||||
sudo cat /etc/myfile | yq e '.a.path = "value"' - | sudo sponge /etc/myfile
|
sudo cat /etc/myfile | yq '.a.path = "value"' | sudo sponge /etc/myfile
|
||||||
```
|
```
|
||||||
or write to a temporary file:
|
or write to a temporary file:
|
||||||
```
|
```
|
||||||
sudo cat /etc/myfile | yq e '.a.path = "value"' | sudo tee /etc/myfile.tmp
|
sudo cat /etc/myfile | yq '.a.path = "value"' | sudo tee /etc/myfile.tmp
|
||||||
sudo mv /etc/myfile.tmp /etc/myfile
|
sudo mv /etc/myfile.tmp /etc/myfile
|
||||||
rm /etc/myfile.tmp
|
rm /etc/myfile.tmp
|
||||||
```
|
```
|
||||||
|
|
||||||
### Run with Docker or Podman
|
### Run with Docker or Podman
|
||||||
|
|
||||||
#### Oneshot use:
|
#### Oneshot use:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker run --rm -v "${PWD}":/workdir mikefarah/yq <command> [flags] [expression ]FILE...
|
docker run --rm -v "${PWD}":/workdir mikefarah/yq [command] [flags] [expression ]FILE...
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Note that you can run `yq` in docker without network access and other privileges if you desire,
|
||||||
|
namely `--security-opt=no-new-privileges --cap-drop all --network none`.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
podman run --rm -v "${PWD}":/workdir mikefarah/yq <command> [flags] [expression ]FILE...
|
podman run --rm -v "${PWD}":/workdir mikefarah/yq [command] [flags] [expression ]FILE...
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Pipe in via STDIN:
|
#### Pipe in via STDIN:
|
||||||
@@ -113,11 +132,11 @@ podman run --rm -v "${PWD}":/workdir mikefarah/yq <command> [flags] [expression
|
|||||||
You'll need to pass the `-i\--interactive` flag to docker:
|
You'll need to pass the `-i\--interactive` flag to docker:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cat myfile.yml | docker run -i --rm mikefarah/yq e . -
|
docker run -i --rm mikefarah/yq '.this.thing' < myfile.yml
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cat myfile.yml | podman run -i --rm mikefarah/yq e . -
|
podman run -i --rm mikefarah/yq '.this.thing' < myfile.yml
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Run commands interactively:
|
#### Run commands interactively:
|
||||||
@@ -143,8 +162,6 @@ yq() {
|
|||||||
podman run --rm -i -v "${PWD}":/workdir mikefarah/yq "$@"
|
podman run --rm -i -v "${PWD}":/workdir mikefarah/yq "$@"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
#### Running as root:
|
#### Running as root:
|
||||||
|
|
||||||
`yq`'s container image no longer runs under root (https://github.com/mikefarah/yq/pull/860). If you'd like to install more things in the container image, or you're having permissions issues when attempting to read/write files you'll need to either:
|
`yq`'s container image no longer runs under root (https://github.com/mikefarah/yq/pull/860). If you'd like to install more things in the container image, or you're having permissions issues when attempting to read/write files you'll need to either:
|
||||||
@@ -164,29 +181,65 @@ Or, in your Dockerfile:
|
|||||||
FROM mikefarah/yq
|
FROM mikefarah/yq
|
||||||
|
|
||||||
USER root
|
USER root
|
||||||
RUN apk add bash
|
RUN apk add --no-cache bash
|
||||||
USER yq
|
USER yq
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Missing timezone data
|
||||||
|
By default, the alpine image yq uses does not include timezone data. If you'd like to use the `tz` operator, you'll need to include this data:
|
||||||
|
|
||||||
|
```
|
||||||
|
FROM mikefarah/yq
|
||||||
|
|
||||||
|
USER root
|
||||||
|
RUN apk add --no-cache tzdata
|
||||||
|
USER yq
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Podman with SELinux
|
||||||
|
|
||||||
|
If you are using podman with SELinux, you will need to set the shared volume flag `:z` on the volume mount:
|
||||||
|
|
||||||
|
```
|
||||||
|
-v "${PWD}":/workdir:z
|
||||||
|
```
|
||||||
|
|
||||||
### GitHub Action
|
### GitHub Action
|
||||||
```
|
```
|
||||||
- name: Set foobar to cool
|
- name: Set foobar to cool
|
||||||
uses: mikefarah/yq@master
|
uses: mikefarah/yq@master
|
||||||
with:
|
with:
|
||||||
cmd: yq eval -i '.foo.bar = "cool"' 'config.yml'
|
cmd: yq -i '.foo.bar = "cool"' 'config.yml'
|
||||||
|
- name: Get an entry with a variable that might contain dots or spaces
|
||||||
|
id: get_username
|
||||||
|
uses: mikefarah/yq@master
|
||||||
|
with:
|
||||||
|
cmd: yq '.all.children.["${{ matrix.ip_address }}"].username' ops/inventories/production.yml
|
||||||
|
- name: Reuse a variable obtained in another step
|
||||||
|
run: echo ${{ steps.get_username.outputs.result }}
|
||||||
```
|
```
|
||||||
|
|
||||||
See https://mikefarah.gitbook.io/yq/usage/github-action for more.
|
See https://mikefarah.gitbook.io/yq/usage/github-action for more.
|
||||||
|
|
||||||
### Go Get:
|
### Go Install:
|
||||||
```
|
```
|
||||||
GO111MODULE=on go get github.com/mikefarah/yq/v4
|
go install github.com/mikefarah/yq/v4@latest
|
||||||
```
|
```
|
||||||
|
|
||||||
## Community Supported Installation methods
|
## Community Supported Installation methods
|
||||||
As these are supported by the community :heart: - however, they may be out of date with the officially supported releases.
|
As these are supported by the community :heart: - however, they may be out of date with the officially supported releases.
|
||||||
|
|
||||||
# Webi
|
|
||||||
|
### Nix
|
||||||
|
|
||||||
|
```
|
||||||
|
nix profile install nixpkgs#yq-go
|
||||||
|
```
|
||||||
|
|
||||||
|
See [here](https://search.nixos.org/packages?channel=unstable&show=yq-go&from=0&size=50&sort=relevance&type=packages&query=yq-go)
|
||||||
|
|
||||||
|
|
||||||
|
### Webi
|
||||||
|
|
||||||
```
|
```
|
||||||
webi yq
|
webi yq
|
||||||
@@ -195,6 +248,12 @@ webi yq
|
|||||||
See [webi](https://webinstall.dev/)
|
See [webi](https://webinstall.dev/)
|
||||||
Supported by @adithyasunil26 (https://github.com/webinstall/webi-installers/tree/master/yq)
|
Supported by @adithyasunil26 (https://github.com/webinstall/webi-installers/tree/master/yq)
|
||||||
|
|
||||||
|
### Arch Linux
|
||||||
|
|
||||||
|
```
|
||||||
|
pacman -S go-yq
|
||||||
|
```
|
||||||
|
|
||||||
### Windows:
|
### Windows:
|
||||||
[](https://chocolatey.org/packages/yq)
|
[](https://chocolatey.org/packages/yq)
|
||||||
[](https://chocolatey.org/packages/yq)
|
[](https://chocolatey.org/packages/yq)
|
||||||
@@ -203,6 +262,13 @@ choco install yq
|
|||||||
```
|
```
|
||||||
Supported by @chillum (https://chocolatey.org/packages/yq)
|
Supported by @chillum (https://chocolatey.org/packages/yq)
|
||||||
|
|
||||||
|
and
|
||||||
|
|
||||||
|
### Winget
|
||||||
|
winget install yq
|
||||||
|
|
||||||
|
https://winget.run/pkg/MikeFarah/yq
|
||||||
|
|
||||||
### Mac:
|
### Mac:
|
||||||
Using [MacPorts](https://www.macports.org/)
|
Using [MacPorts](https://www.macports.org/)
|
||||||
```
|
```
|
||||||
@@ -232,20 +298,23 @@ Supported by @rmescandon (https://launchpad.net/~rmescandon/+archive/ubuntu/yq)
|
|||||||
## Features
|
## Features
|
||||||
- [Detailed documentation with many examples](https://mikefarah.gitbook.io/yq/)
|
- [Detailed documentation with many examples](https://mikefarah.gitbook.io/yq/)
|
||||||
- Written in portable go, so you can download a lovely dependency free binary
|
- Written in portable go, so you can download a lovely dependency free binary
|
||||||
- Uses similar syntax as `jq` but works with YAML and JSON files
|
- Uses similar syntax as `jq` but works with YAML, [JSON](https://mikefarah.gitbook.io/yq/usage/convert) and [XML](https://mikefarah.gitbook.io/yq/usage/xml) files
|
||||||
- Fully supports multi document yaml files
|
- Fully supports multi document yaml files
|
||||||
- Supports yaml [front matter](https://mikefarah.gitbook.io/yq/usage/front-matter) blocks (e.g. jekyll/assemble)
|
- Supports yaml [front matter](https://mikefarah.gitbook.io/yq/usage/front-matter) blocks (e.g. jekyll/assemble)
|
||||||
- Colorized yaml output
|
- Colorized yaml output
|
||||||
- [Deeply traverse yaml](https://mikefarah.gitbook.io/yq/operators/traverse-read)
|
- [Date/Time manipulation and formatting with TZ](https://mikefarah.gitbook.io/yq/operators/datetime)
|
||||||
- [Sort yaml by keys](https://mikefarah.gitbook.io/yq/operators/sort-keys)
|
- [Deeply data structures](https://mikefarah.gitbook.io/yq/operators/traverse-read)
|
||||||
|
- [Sort keys](https://mikefarah.gitbook.io/yq/operators/sort-keys)
|
||||||
- Manipulate yaml [comments](https://mikefarah.gitbook.io/yq/operators/comment-operators), [styling](https://mikefarah.gitbook.io/yq/operators/style), [tags](https://mikefarah.gitbook.io/yq/operators/tag) and [anchors and aliases](https://mikefarah.gitbook.io/yq/operators/anchor-and-alias-operators).
|
- Manipulate yaml [comments](https://mikefarah.gitbook.io/yq/operators/comment-operators), [styling](https://mikefarah.gitbook.io/yq/operators/style), [tags](https://mikefarah.gitbook.io/yq/operators/tag) and [anchors and aliases](https://mikefarah.gitbook.io/yq/operators/anchor-and-alias-operators).
|
||||||
- [Update yaml inplace](https://mikefarah.gitbook.io/yq/v/v4.x/commands/evaluate#flags)
|
- [Update inplace](https://mikefarah.gitbook.io/yq/v/v4.x/commands/evaluate#flags)
|
||||||
- [Complex expressions to select and update](https://mikefarah.gitbook.io/yq/operators/select#select-and-update-matching-values-in-map)
|
- [Complex expressions to select and update](https://mikefarah.gitbook.io/yq/operators/select#select-and-update-matching-values-in-map)
|
||||||
- Keeps yaml formatting and comments when updating (though there are issues with whitespace)
|
- Keeps yaml formatting and comments when updating (though there are issues with whitespace)
|
||||||
|
- [Decode/Encode base64 data](https://mikefarah.gitbook.io/yq/operators/encode-decode)
|
||||||
- [Load content from other files](https://mikefarah.gitbook.io/yq/operators/load)
|
- [Load content from other files](https://mikefarah.gitbook.io/yq/operators/load)
|
||||||
- [Convert to/from json](https://mikefarah.gitbook.io/yq/v/v4.x/usage/convert)
|
- [Convert to/from json/ndjson](https://mikefarah.gitbook.io/yq/v/v4.x/usage/convert)
|
||||||
- [Convert to properties](https://mikefarah.gitbook.io/yq/v/v4.x/usage/properties)
|
- [Convert to/from xml](https://mikefarah.gitbook.io/yq/v/v4.x/usage/xml)
|
||||||
- [Pipe data in by using '-'](https://mikefarah.gitbook.io/yq/v/v4.x/commands/evaluate)
|
- [Convert to/from properties](https://mikefarah.gitbook.io/yq/v/v4.x/usage/properties)
|
||||||
|
- [Convert to/from csv/tsv](https://mikefarah.gitbook.io/yq/usage/csv-tsv)
|
||||||
- [General shell completion scripts (bash/zsh/fish/powershell)](https://mikefarah.gitbook.io/yq/v/v4.x/commands/shell-completion)
|
- [General shell completion scripts (bash/zsh/fish/powershell)](https://mikefarah.gitbook.io/yq/v/v4.x/commands/shell-completion)
|
||||||
- [Reduce](https://mikefarah.gitbook.io/yq/operators/reduce) to merge multiple files or sum an array or other fancy things.
|
- [Reduce](https://mikefarah.gitbook.io/yq/operators/reduce) to merge multiple files or sum an array or other fancy things.
|
||||||
- [Github Action](https://mikefarah.gitbook.io/yq/usage/github-action) to use in your automated pipeline (thanks @devorbitus)
|
- [Github Action](https://mikefarah.gitbook.io/yq/usage/github-action) to use in your automated pipeline (thanks @devorbitus)
|
||||||
@@ -259,28 +328,41 @@ Usage:
|
|||||||
yq [flags]
|
yq [flags]
|
||||||
yq [command]
|
yq [command]
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
|
||||||
|
# yq defaults to 'eval' command if no command is specified. See "yq eval --help" for more examples.
|
||||||
|
yq '.stuff' < myfile.yml # outputs the data at the "stuff" node from "myfile.yml"
|
||||||
|
|
||||||
|
yq -i '.stuff = "foo"' myfile.yml # update myfile.yml inplace
|
||||||
|
|
||||||
|
|
||||||
Available Commands:
|
Available Commands:
|
||||||
eval Apply the expression to each document in each yaml file in sequence
|
completion Generate the autocompletion script for the specified shell
|
||||||
|
eval (default) Apply the expression to each document in each yaml file in sequence
|
||||||
eval-all Loads _all_ yaml documents of _all_ yaml files and runs expression once
|
eval-all Loads _all_ yaml documents of _all_ yaml files and runs expression once
|
||||||
help Help about any command
|
help Help about any command
|
||||||
shell-completion Generate completion script
|
shell-completion Generate completion script
|
||||||
|
|
||||||
Flags:
|
Flags:
|
||||||
-C, --colors force print with colors
|
-C, --colors force print with colors
|
||||||
-e, --exit-status set exit status if there are no matches or null or false is returned
|
-e, --exit-status set exit status if there are no matches or null or false is returned
|
||||||
-f, --front-matter string (extract|process) first input as yaml front-matter. Extract will pull out the yaml content, process will run the expression against the yaml content, leaving the remaining data intact
|
-f, --front-matter string (extract|process) first input as yaml front-matter. Extract will pull out the yaml content, process will run the expression against the yaml content, leaving the remaining data intact
|
||||||
--header-preprocess Slurp any header comments and seperators before processing expression. This is a workaround for go-yaml to persist header content (default true)
|
--header-preprocess Slurp any header comments and separators before processing expression. (default true)
|
||||||
-h, --help help for yq
|
-h, --help help for yq
|
||||||
-I, --indent int sets indent level for output (default 2)
|
-I, --indent int sets indent level for output (default 2)
|
||||||
-i, --inplace update the yaml file inplace of first yaml file given.
|
-i, --inplace update the file inplace of first file given.
|
||||||
-M, --no-colors force print with no colors
|
-p, --input-format string [yaml|y|xml|x] parse format for input. Note that json is a subset of yaml. (default "yaml")
|
||||||
-N, --no-doc Don't print document separators (---)
|
-M, --no-colors force print with no colors
|
||||||
-n, --null-input Don't read input, simply evaluate the expression given. Useful for creating yaml docs from scratch.
|
-N, --no-doc Don't print document separators (---)
|
||||||
-o, --output-format string [yaml|y|json|j|props|p] output format type. (default "yaml")
|
-n, --null-input Don't read input, simply evaluate the expression given. Useful for creating docs from scratch.
|
||||||
-P, --prettyPrint pretty print, shorthand for '... style = ""'
|
-o, --output-format string [yaml|y|json|j|props|p|xml|x] output format type. (default "yaml")
|
||||||
--unwrapScalar unwrap scalar, print the value with no quotes, colors or comments (default true)
|
-P, --prettyPrint pretty print, shorthand for '... style = ""'
|
||||||
-v, --verbose verbose mode
|
-s, --split-exp string print each result (or doc) into a file named (exp). [exp] argument must return a string. You can use $index in the expression as the result counter.
|
||||||
-V, --version Print version information and quit
|
--unwrapScalar unwrap scalar, print the value with no quotes, colors or comments (default true)
|
||||||
|
-v, --verbose verbose mode
|
||||||
|
-V, --version Print version information and quit
|
||||||
|
--xml-attribute-prefix string prefix for xml attributes (default "+")
|
||||||
|
--xml-content-name string name for xml content (if no attribute name is present). (default "+content")
|
||||||
|
|
||||||
Use "yq [command] --help" for more information about a command.
|
Use "yq [command] --help" for more information about a command.
|
||||||
```
|
```
|
||||||
|
|||||||
+286
-2
@@ -1,12 +1,225 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
setUp() {
|
setUp() {
|
||||||
rm test*.yml || true
|
rm test*.yml 2>/dev/null || true
|
||||||
|
rm .xyz 2>/dev/null || true
|
||||||
|
rm instructions.txt 2>/dev/null || true
|
||||||
}
|
}
|
||||||
|
|
||||||
testBasicEvalRoundTrip() {
|
testBasicEvalRoundTrip() {
|
||||||
|
./yq -n ".a = 123" > test.yml
|
||||||
|
X=$(./yq '.a' test.yml)
|
||||||
|
assertEquals 123 "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
testBasicTrailingContent() {
|
||||||
|
cat >test-trailing.yml <<EOL
|
||||||
|
test:
|
||||||
|
# this comment will be removed
|
||||||
|
EOL
|
||||||
|
|
||||||
|
read -r -d '' expected << EOM
|
||||||
|
test:
|
||||||
|
# this comment will be removed
|
||||||
|
EOM
|
||||||
|
X=$(./yq test-trailing.yml -P)
|
||||||
|
assertEquals "$expected" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
testBasicTrailingContent() {
|
||||||
|
cat >test-trailing.yml <<EOL
|
||||||
|
test:
|
||||||
|
# this comment will be removed
|
||||||
|
EOL
|
||||||
|
|
||||||
|
read -r -d '' expected << EOM
|
||||||
|
test:
|
||||||
|
# hi
|
||||||
|
EOM
|
||||||
|
X=$(./yq '. footComment = "hi"' test-trailing.yml)
|
||||||
|
assertEquals "$expected" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
testBasicTrailingContentEvalAll() {
|
||||||
|
cat >test-trailing.yml <<EOL
|
||||||
|
test:
|
||||||
|
# this comment will be removed
|
||||||
|
EOL
|
||||||
|
|
||||||
|
read -r -d '' expected << EOM
|
||||||
|
test:
|
||||||
|
# this comment will be removed
|
||||||
|
EOM
|
||||||
|
X=$(./yq ea test-trailing.yml -P)
|
||||||
|
assertEquals "$expected" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
testBasicTrailingContentEvalAll() {
|
||||||
|
cat >test-trailing.yml <<EOL
|
||||||
|
test:
|
||||||
|
# this comment will be removed
|
||||||
|
EOL
|
||||||
|
|
||||||
|
read -r -d '' expected << EOM
|
||||||
|
test:
|
||||||
|
# hi
|
||||||
|
EOM
|
||||||
|
X=$(./yq ea '. footComment = "hi"' test-trailing.yml)
|
||||||
|
assertEquals "$expected" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
testBasicPipeWithDot() {
|
||||||
|
./yq -n ".a = 123" > test.yml
|
||||||
|
X=$(cat test.yml | ./yq '.')
|
||||||
|
assertEquals "a: 123" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
testBasicExpressionMatchesFileName() {
|
||||||
|
./yq -n ".xyz = 123" > test.yml
|
||||||
|
touch .xyz
|
||||||
|
|
||||||
|
X=$(./yq --expression '.xyz' test.yml)
|
||||||
|
assertEquals "123" "$X"
|
||||||
|
|
||||||
|
X=$(./yq ea --expression '.xyz' test.yml)
|
||||||
|
assertEquals "123" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
testBasicExpressionFromFile() {
|
||||||
|
./yq -n ".xyz = 123" > test.yml
|
||||||
|
echo '.xyz = "meow" | .cool = "frog"' > instructions.txt
|
||||||
|
|
||||||
|
X=$(./yq --from-file instructions.txt test.yml -o=j -I=0)
|
||||||
|
assertEquals '{"xyz":"meow","cool":"frog"}' "$X"
|
||||||
|
|
||||||
|
X=$(./yq ea --from-file instructions.txt test.yml -o=j -I=0)
|
||||||
|
assertEquals '{"xyz":"meow","cool":"frog"}' "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
testBasicGitHubAction() {
|
||||||
|
./yq -n ".a = 123" > test.yml
|
||||||
|
X=$(cat /dev/null | ./yq test.yml)
|
||||||
|
assertEquals "a: 123" "$X"
|
||||||
|
|
||||||
|
X=$(cat /dev/null | ./yq e test.yml)
|
||||||
|
assertEquals "a: 123" "$X"
|
||||||
|
|
||||||
|
X=$(cat /dev/null | ./yq ea test.yml)
|
||||||
|
assertEquals "a: 123" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
testBasicGitHubActionWithExpression() {
|
||||||
|
./yq -n ".a = 123" > test.yml
|
||||||
|
X=$(cat /dev/null | ./yq '.a' test.yml)
|
||||||
|
assertEquals "123" "$X"
|
||||||
|
|
||||||
|
X=$(cat /dev/null | ./yq e '.a' test.yml)
|
||||||
|
assertEquals "123" "$X"
|
||||||
|
|
||||||
|
X=$(cat /dev/null | ./yq ea '.a' test.yml)
|
||||||
|
assertEquals "123" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
testBasicEvalAllAllFiles() {
|
||||||
|
./yq -n ".a = 123" > test.yml
|
||||||
|
./yq -n ".a = 124" > test2.yml
|
||||||
|
X=$(./yq ea test.yml test2.yml)
|
||||||
|
Y=$(./yq e '.' test.yml test2.yml)
|
||||||
|
assertEquals "$Y" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
# when given a file, don't read STDIN
|
||||||
|
# otherwise strange things start happening
|
||||||
|
# in scripts
|
||||||
|
# https://github.com/mikefarah/yq/issues/1115
|
||||||
|
|
||||||
|
testBasicCatWithFilesNoDash() {
|
||||||
|
./yq -n ".a = 123" > test.yml
|
||||||
|
./yq -n ".a = 124" > test2.yml
|
||||||
|
X=$(cat test.yml | ./yq test2.yml)
|
||||||
|
Y=$(./yq e '.' test2.yml)
|
||||||
|
assertEquals "$Y" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
# when the nullinput flag is used
|
||||||
|
# dont automatically read STDIN (this breaks github actions)
|
||||||
|
testBasicCreateFileGithubAction() {
|
||||||
|
cat /dev/null | ./yq -n ".a = 123" > test.yml
|
||||||
|
}
|
||||||
|
|
||||||
|
testBasicEvalAllCatWithFilesNoDash() {
|
||||||
|
./yq -n ".a = 123" > test.yml
|
||||||
|
./yq -n ".a = 124" > test2.yml
|
||||||
|
X=$(cat test.yml | ./yq ea test2.yml)
|
||||||
|
Y=$(./yq e '.' test2.yml)
|
||||||
|
assertEquals "$Y" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
testBasicCatWithFilesNoDashWithExp() {
|
||||||
|
./yq -n ".a = 123" > test.yml
|
||||||
|
./yq -n ".a = 124" > test2.yml
|
||||||
|
X=$(cat test.yml | ./yq '.a' test2.yml)
|
||||||
|
Y=$(./yq e '.a' test2.yml)
|
||||||
|
assertEquals "$Y" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
testBasicEvalAllCatWithFilesNoDashWithExp() {
|
||||||
|
./yq -n ".a = 123" > test.yml
|
||||||
|
./yq -n ".a = 124" > test2.yml
|
||||||
|
X=$(cat test.yml | ./yq ea '.a' test2.yml)
|
||||||
|
Y=$(./yq e '.a' test2.yml)
|
||||||
|
assertEquals "$Y" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
testBasicStdInWithFiles() {
|
||||||
|
./yq -n ".a = 123" > test.yml
|
||||||
|
./yq -n ".a = 124" > test2.yml
|
||||||
|
X=$(cat test.yml | ./yq - test2.yml)
|
||||||
|
Y=$(./yq e '.' test.yml test2.yml)
|
||||||
|
assertEquals "$Y" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
testBasicEvalAllStdInWithFiles() {
|
||||||
|
./yq -n ".a = 123" > test.yml
|
||||||
|
./yq -n ".a = 124" > test2.yml
|
||||||
|
X=$(cat test.yml | ./yq ea - test2.yml)
|
||||||
|
Y=$(./yq e '.' test.yml test2.yml)
|
||||||
|
assertEquals "$Y" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
testBasicStdInWithFilesReverse() {
|
||||||
|
./yq -n ".a = 123" > test.yml
|
||||||
|
./yq -n ".a = 124" > test2.yml
|
||||||
|
X=$(cat test.yml | ./yq test2.yml -)
|
||||||
|
Y=$(./yq e '.' test2.yml test.yml)
|
||||||
|
assertEquals "$Y" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
testBasicEvalAllStdInWithFilesReverse() {
|
||||||
|
./yq -n ".a = 123" > test.yml
|
||||||
|
./yq -n ".a = 124" > test2.yml
|
||||||
|
X=$(cat test.yml | ./yq ea test2.yml -)
|
||||||
|
Y=$(./yq e '.' test2.yml test.yml)
|
||||||
|
assertEquals "$Y" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
testBasicEvalRoundTripNoEval() {
|
||||||
|
./yq -n ".a = 123" > test.yml
|
||||||
|
X=$(./yq '.a' test.yml)
|
||||||
|
assertEquals 123 "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
testBasicStdInWithOneArg() {
|
||||||
./yq e -n ".a = 123" > test.yml
|
./yq e -n ".a = 123" > test.yml
|
||||||
X=$(./yq e '.a' test.yml)
|
X=$(cat test.yml | ./yq e ".a")
|
||||||
|
assertEquals 123 "$X"
|
||||||
|
|
||||||
|
X=$(cat test.yml | ./yq ea ".a")
|
||||||
|
assertEquals 123 "$X"
|
||||||
|
|
||||||
|
X=$(cat test.yml | ./yq ".a")
|
||||||
assertEquals 123 "$X"
|
assertEquals 123 "$X"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -19,6 +232,15 @@ EOL
|
|||||||
assertEquals "10" "$X"
|
assertEquals "10" "$X"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
testBasicUpdateInPlaceSequenceNoEval() {
|
||||||
|
cat >test.yml <<EOL
|
||||||
|
a: 0
|
||||||
|
EOL
|
||||||
|
./yq -i ".a = 10" test.yml
|
||||||
|
X=$(./yq '.a' test.yml)
|
||||||
|
assertEquals "10" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
testBasicUpdateInPlaceSequenceEvalAll() {
|
testBasicUpdateInPlaceSequenceEvalAll() {
|
||||||
cat >test.yml <<EOL
|
cat >test.yml <<EOL
|
||||||
a: 0
|
a: 0
|
||||||
@@ -28,6 +250,40 @@ EOL
|
|||||||
assertEquals "10" "$X"
|
assertEquals "10" "$X"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
testBasicUpdateInPlaceMultipleFilesNoExpressionEval() {
|
||||||
|
cat >test.yml <<EOL
|
||||||
|
a: 0
|
||||||
|
EOL
|
||||||
|
cat >test2.yml <<EOL
|
||||||
|
a: 1
|
||||||
|
EOL
|
||||||
|
read -r -d '' expected << EOM
|
||||||
|
0
|
||||||
|
---
|
||||||
|
1
|
||||||
|
EOM
|
||||||
|
./yq -i test.yml test2.yml
|
||||||
|
X=$(./yq e '.a' test.yml)
|
||||||
|
assertEquals "$expected" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
testBasicUpdateInPlaceMultipleFilesNoExpressionEvalAll() {
|
||||||
|
cat >test.yml <<EOL
|
||||||
|
a: 0
|
||||||
|
EOL
|
||||||
|
cat >test2.yml <<EOL
|
||||||
|
a: 1
|
||||||
|
EOL
|
||||||
|
read -r -d '' expected << EOM
|
||||||
|
0
|
||||||
|
---
|
||||||
|
1
|
||||||
|
EOM
|
||||||
|
./yq -i ea test.yml test2.yml
|
||||||
|
X=$(./yq e '.a' test.yml)
|
||||||
|
assertEquals "$expected" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
testBasicNoExitStatus() {
|
testBasicNoExitStatus() {
|
||||||
echo "a: cat" > test.yml
|
echo "a: cat" > test.yml
|
||||||
X=$(./yq e '.z' test.yml)
|
X=$(./yq e '.z' test.yml)
|
||||||
@@ -40,6 +296,12 @@ testBasicExitStatus() {
|
|||||||
assertEquals 1 "$?"
|
assertEquals 1 "$?"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
testBasicExitStatusNoEval() {
|
||||||
|
echo "a: cat" > test.yml
|
||||||
|
X=$(./yq -e '.z' test.yml 2&>/dev/null)
|
||||||
|
assertEquals 1 "$?"
|
||||||
|
}
|
||||||
|
|
||||||
testBasicExtractFieldWithSeperator() {
|
testBasicExtractFieldWithSeperator() {
|
||||||
cat >test.yml <<EOL
|
cat >test.yml <<EOL
|
||||||
---
|
---
|
||||||
@@ -69,4 +331,26 @@ EOM
|
|||||||
assertEquals "$expected" "$X"
|
assertEquals "$expected" "$X"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
testBasicMultiplyAssignMultiDoc() {
|
||||||
|
cat >test.yml <<EOL
|
||||||
|
a: 1
|
||||||
|
---
|
||||||
|
b: 2
|
||||||
|
EOL
|
||||||
|
|
||||||
|
read -r -d '' expected << EOM
|
||||||
|
a: 1
|
||||||
|
c: 3
|
||||||
|
---
|
||||||
|
b: 2
|
||||||
|
c: 3
|
||||||
|
EOM
|
||||||
|
|
||||||
|
|
||||||
|
X=$(./yq '. *= {"c":3}' test.yml)
|
||||||
|
assertEquals "$expected" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
source ./scripts/shunit2
|
source ./scripts/shunit2
|
||||||
Executable
+9
@@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
testCompletionRuns() {
|
||||||
|
result=$(./yq __complete "" 2>&1)
|
||||||
|
assertEquals 0 $?
|
||||||
|
assertContains "$result" "Completion ended with directive:"
|
||||||
|
}
|
||||||
|
|
||||||
|
source ./scripts/shunit2
|
||||||
@@ -9,7 +9,7 @@ EOL
|
|||||||
|
|
||||||
testEmptyEval() {
|
testEmptyEval() {
|
||||||
X=$(./yq e test.yml)
|
X=$(./yq e test.yml)
|
||||||
expected=$(cat test.yml)
|
expected="# comment"
|
||||||
assertEquals 0 $?
|
assertEquals 0 $?
|
||||||
assertEquals "$expected" "$X"
|
assertEquals "$expected" "$X"
|
||||||
}
|
}
|
||||||
|
|||||||
Executable
+43
@@ -0,0 +1,43 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
setUp() {
|
||||||
|
rm test*.yml || true
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
testLineCountFirstLineComment() {
|
||||||
|
cat >test.yml <<EOL
|
||||||
|
#test123
|
||||||
|
abc: 123
|
||||||
|
test123: 123123
|
||||||
|
#comment
|
||||||
|
lalilu: lalilu
|
||||||
|
EOL
|
||||||
|
|
||||||
|
X=$(./yq '.lalilu | line' --header-preprocess=false < test.yml)
|
||||||
|
assertEquals "5" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
testArrayOfDocs() {
|
||||||
|
cat >test.yml <<EOL
|
||||||
|
---
|
||||||
|
# leading comment doc 1
|
||||||
|
a: 1
|
||||||
|
---
|
||||||
|
# leading comment doc 2
|
||||||
|
a: 2
|
||||||
|
EOL
|
||||||
|
|
||||||
|
read -r -d '' expected << EOM
|
||||||
|
- # leading comment doc 1
|
||||||
|
a: 1
|
||||||
|
- # leading comment doc 2
|
||||||
|
a: 2
|
||||||
|
EOM
|
||||||
|
|
||||||
|
X=$(./yq ea '[.]' --header-preprocess=false < test.yml)
|
||||||
|
assertEquals "$expected" "$X"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
source ./scripts/shunit2
|
||||||
Executable
+203
@@ -0,0 +1,203 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
setUp() {
|
||||||
|
rm test*.yml 2>/dev/null || true
|
||||||
|
rm test*.properties 2>/dev/null || true
|
||||||
|
rm test*.csv 2>/dev/null || true
|
||||||
|
rm test*.tsv 2>/dev/null || true
|
||||||
|
rm test*.xml 2>/dev/null || true
|
||||||
|
}
|
||||||
|
|
||||||
|
testInputProperties() {
|
||||||
|
cat >test.properties <<EOL
|
||||||
|
mike.things = hello
|
||||||
|
EOL
|
||||||
|
|
||||||
|
read -r -d '' expected << EOM
|
||||||
|
mike:
|
||||||
|
things: hello
|
||||||
|
EOM
|
||||||
|
|
||||||
|
X=$(./yq e -p=props test.properties)
|
||||||
|
assertEquals "$expected" "$X"
|
||||||
|
|
||||||
|
X=$(./yq ea -p=props test.properties)
|
||||||
|
assertEquals "$expected" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
testInputPropertiesGitHubAction() {
|
||||||
|
cat >test.properties <<EOL
|
||||||
|
mike.things = hello
|
||||||
|
EOL
|
||||||
|
|
||||||
|
read -r -d '' expected << EOM
|
||||||
|
mike:
|
||||||
|
things: hello
|
||||||
|
EOM
|
||||||
|
|
||||||
|
X=$(cat /dev/null | ./yq e -p=props test.properties)
|
||||||
|
assertEquals "$expected" "$X"
|
||||||
|
|
||||||
|
X=$(cat /dev/null | ./yq ea -p=props test.properties)
|
||||||
|
assertEquals "$expected" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
testInputCSV() {
|
||||||
|
cat >test.csv <<EOL
|
||||||
|
fruit,yumLevel
|
||||||
|
apple,5
|
||||||
|
banana,4
|
||||||
|
EOL
|
||||||
|
|
||||||
|
read -r -d '' expected << EOM
|
||||||
|
- fruit: apple
|
||||||
|
yumLevel: 5
|
||||||
|
- fruit: banana
|
||||||
|
yumLevel: 4
|
||||||
|
EOM
|
||||||
|
|
||||||
|
X=$(./yq e -p=csv test.csv)
|
||||||
|
assertEquals "$expected" "$X"
|
||||||
|
|
||||||
|
X=$(./yq ea -p=csv test.csv)
|
||||||
|
assertEquals "$expected" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
testInputCSVUTF8() {
|
||||||
|
read -r -d '' expected << EOM
|
||||||
|
- id: 1
|
||||||
|
first: john
|
||||||
|
last: smith
|
||||||
|
- id: 1
|
||||||
|
first: jane
|
||||||
|
last: smith
|
||||||
|
EOM
|
||||||
|
|
||||||
|
X=$(./yq -p=csv utf8.csv)
|
||||||
|
assertEquals "$expected" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
testInputTSV() {
|
||||||
|
cat >test.tsv <<EOL
|
||||||
|
fruit yumLevel
|
||||||
|
apple 5
|
||||||
|
banana 4
|
||||||
|
EOL
|
||||||
|
|
||||||
|
read -r -d '' expected << EOM
|
||||||
|
- fruit: apple
|
||||||
|
yumLevel: 5
|
||||||
|
- fruit: banana
|
||||||
|
yumLevel: 4
|
||||||
|
EOM
|
||||||
|
|
||||||
|
X=$(./yq e -p=t test.tsv)
|
||||||
|
assertEquals "$expected" "$X"
|
||||||
|
|
||||||
|
X=$(./yq ea -p=t test.tsv)
|
||||||
|
assertEquals "$expected" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
testInputXml() {
|
||||||
|
cat >test.yml <<EOL
|
||||||
|
<cat legs="4">BiBi</cat>
|
||||||
|
EOL
|
||||||
|
|
||||||
|
read -r -d '' expected << EOM
|
||||||
|
cat:
|
||||||
|
+content: BiBi
|
||||||
|
+@legs: "4"
|
||||||
|
EOM
|
||||||
|
|
||||||
|
X=$(./yq e -p=xml test.yml)
|
||||||
|
assertEquals "$expected" "$X"
|
||||||
|
|
||||||
|
X=$(./yq ea -p=xml test.yml)
|
||||||
|
assertEquals "$expected" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
testInputXmlNamespaces() {
|
||||||
|
cat >test.yml <<EOL
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<map xmlns="some-namespace" xmlns:xsi="some-instance" xsi:schemaLocation="some-url">
|
||||||
|
</map>
|
||||||
|
EOL
|
||||||
|
|
||||||
|
read -r -d '' expected << EOM
|
||||||
|
+p_xml: version="1.0"
|
||||||
|
map:
|
||||||
|
+@xmlns: some-namespace
|
||||||
|
+@xmlns:xsi: some-instance
|
||||||
|
+@xsi:schemaLocation: some-url
|
||||||
|
EOM
|
||||||
|
|
||||||
|
X=$(./yq e -p=xml test.yml)
|
||||||
|
assertEquals "$expected" "$X"
|
||||||
|
|
||||||
|
X=$(./yq ea -p=xml test.yml)
|
||||||
|
assertEquals "$expected" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
testInputXmlRoundtrip() {
|
||||||
|
cat >test.yml <<EOL
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<!DOCTYPE config SYSTEM "/etc/iwatch/iwatch.dtd" >
|
||||||
|
<map xmlns="some-namespace" xmlns:xsi="some-instance" xsi:schemaLocation="some-url">Meow</map>
|
||||||
|
EOL
|
||||||
|
|
||||||
|
read -r -d '' expected << EOM
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<!DOCTYPE config SYSTEM "/etc/iwatch/iwatch.dtd" >
|
||||||
|
<map xmlns="some-namespace" xmlns:xsi="some-instance" xsi:schemaLocation="some-url">Meow</map>
|
||||||
|
EOM
|
||||||
|
|
||||||
|
X=$(./yq -p=xml -o=xml test.yml)
|
||||||
|
assertEquals "$expected" "$X"
|
||||||
|
|
||||||
|
X=$(./yq ea -p=xml -o=xml test.yml)
|
||||||
|
assertEquals "$expected" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
testInputXmlStrict() {
|
||||||
|
cat >test.yml <<EOL
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<!DOCTYPE root [
|
||||||
|
<!ENTITY writer "Catherine.">
|
||||||
|
<!ENTITY copyright "(r) Great">
|
||||||
|
]>
|
||||||
|
<root>
|
||||||
|
<item>&writer;©right;</item>
|
||||||
|
</root>
|
||||||
|
EOL
|
||||||
|
|
||||||
|
X=$(./yq -p=xml --xml-strict-mode test.yml -o=xml 2>&1)
|
||||||
|
assertEquals 1 $?
|
||||||
|
assertEquals "Error: bad file 'test.yml': XML syntax error on line 7: invalid character entity &writer;" "$X"
|
||||||
|
|
||||||
|
X=$(./yq ea -p=xml --xml-strict-mode test.yml -o=xml 2>&1)
|
||||||
|
assertEquals "Error: bad file 'test.yml': XML syntax error on line 7: invalid character entity &writer;" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
testInputXmlGithubAction() {
|
||||||
|
cat >test.yml <<EOL
|
||||||
|
<cat legs="4">BiBi</cat>
|
||||||
|
EOL
|
||||||
|
|
||||||
|
read -r -d '' expected << EOM
|
||||||
|
cat:
|
||||||
|
+content: BiBi
|
||||||
|
+@legs: "4"
|
||||||
|
EOM
|
||||||
|
|
||||||
|
X=$(cat /dev/null | ./yq e -p=xml test.yml)
|
||||||
|
assertEquals "$expected" "$X"
|
||||||
|
|
||||||
|
X=$(cat /dev/null | ./yq ea -p=xml test.yml)
|
||||||
|
assertEquals "$expected" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
source ./scripts/shunit2
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
|
# examples where header-preprocess is required
|
||||||
|
|
||||||
setUp() {
|
setUp() {
|
||||||
rm test*.yml || true
|
rm test*.yml || true
|
||||||
cat >test.yml <<EOL
|
cat >test.yml <<EOL
|
||||||
@@ -31,6 +34,82 @@ EOM
|
|||||||
assertEquals "$expected" "$X"
|
assertEquals "$expected" "$X"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
testLeadingSeperatorWithNewlinesNewDoc() {
|
||||||
|
cat >test.yml <<EOL
|
||||||
|
# hi peeps
|
||||||
|
# cool
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
a: test
|
||||||
|
---
|
||||||
|
b: cool
|
||||||
|
EOL
|
||||||
|
|
||||||
|
read -r -d '' expected << EOM
|
||||||
|
# hi peeps
|
||||||
|
# cool
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
a: thing
|
||||||
|
---
|
||||||
|
b: cool
|
||||||
|
EOM
|
||||||
|
|
||||||
|
X=$(./yq e '(select(di == 0) | .a) = "thing"' - < test.yml)
|
||||||
|
assertEquals "$expected" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
testLeadingSeperatorWithNewlinesMoreComments() {
|
||||||
|
cat >test.yml <<EOL
|
||||||
|
# hi peeps
|
||||||
|
# cool
|
||||||
|
|
||||||
|
---
|
||||||
|
# great
|
||||||
|
|
||||||
|
a: test
|
||||||
|
---
|
||||||
|
b: cool
|
||||||
|
EOL
|
||||||
|
|
||||||
|
read -r -d '' expected << EOM
|
||||||
|
# hi peeps
|
||||||
|
# cool
|
||||||
|
|
||||||
|
---
|
||||||
|
# great
|
||||||
|
|
||||||
|
a: thing
|
||||||
|
---
|
||||||
|
b: cool
|
||||||
|
EOM
|
||||||
|
|
||||||
|
X=$(./yq e '(select(di == 0) | .a) = "thing"' - < test.yml)
|
||||||
|
assertEquals "$expected" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
testLeadingSeperatorWithDirective() {
|
||||||
|
cat >test.yml <<EOL
|
||||||
|
%YAML 1.1
|
||||||
|
---
|
||||||
|
this: should really work
|
||||||
|
EOL
|
||||||
|
|
||||||
|
read -r -d '' expected << EOM
|
||||||
|
%YAML 1.1
|
||||||
|
---
|
||||||
|
this: should really work
|
||||||
|
EOM
|
||||||
|
|
||||||
|
X=$(./yq < test.yml)
|
||||||
|
assertEquals "$expected" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
testLeadingSeperatorPipeIntoEvalSeq() {
|
testLeadingSeperatorPipeIntoEvalSeq() {
|
||||||
X=$(./yq e - < test.yml)
|
X=$(./yq e - < test.yml)
|
||||||
expected=$(cat test.yml)
|
expected=$(cat test.yml)
|
||||||
|
|||||||
@@ -48,6 +48,55 @@ EOM
|
|||||||
assertEquals "$expected" "$X"
|
assertEquals "$expected" "$X"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
testOutputYamlRawDefault() {
|
||||||
|
cat >test.yml <<EOL
|
||||||
|
a: "cat"
|
||||||
|
EOL
|
||||||
|
|
||||||
|
X=$(./yq e '.a' test.yml)
|
||||||
|
assertEquals "cat" "$X"
|
||||||
|
|
||||||
|
X=$(./yq ea '.a' test.yml)
|
||||||
|
assertEquals "cat" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
testOutputYamlRawOff() {
|
||||||
|
cat >test.yml <<EOL
|
||||||
|
a: "cat"
|
||||||
|
EOL
|
||||||
|
|
||||||
|
X=$(./yq e -r=false '.a' test.yml)
|
||||||
|
assertEquals "\"cat\"" "$X"
|
||||||
|
|
||||||
|
X=$(./yq ea -r=false '.a' test.yml)
|
||||||
|
assertEquals "\"cat\"" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
testOutputJsonRaw() {
|
||||||
|
cat >test.yml <<EOL
|
||||||
|
a: cat
|
||||||
|
EOL
|
||||||
|
|
||||||
|
X=$(./yq e -r --output-format=json '.a' test.yml)
|
||||||
|
assertEquals "cat" "$X"
|
||||||
|
|
||||||
|
X=$(./yq ea -r --output-format=json '.a' test.yml)
|
||||||
|
assertEquals "cat" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
testOutputJsonDefault() {
|
||||||
|
cat >test.yml <<EOL
|
||||||
|
a: cat
|
||||||
|
EOL
|
||||||
|
|
||||||
|
X=$(./yq e --output-format=json '.a' test.yml)
|
||||||
|
assertEquals "\"cat\"" "$X"
|
||||||
|
|
||||||
|
X=$(./yq ea --output-format=json '.a' test.yml)
|
||||||
|
assertEquals "\"cat\"" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
testOutputJsonShort() {
|
testOutputJsonShort() {
|
||||||
cat >test.yml <<EOL
|
cat >test.yml <<EOL
|
||||||
a: {b: ["cat"]}
|
a: {b: ["cat"]}
|
||||||
@@ -72,11 +121,11 @@ EOM
|
|||||||
|
|
||||||
testOutputProperties() {
|
testOutputProperties() {
|
||||||
cat >test.yml <<EOL
|
cat >test.yml <<EOL
|
||||||
a: {b: {c: ["cat"]}}
|
a: {b: {c: ["cat cat"]}}
|
||||||
EOL
|
EOL
|
||||||
|
|
||||||
read -r -d '' expected << EOM
|
read -r -d '' expected << EOM
|
||||||
a.b.c.0 = cat
|
a.b.c.0 = cat cat
|
||||||
EOM
|
EOM
|
||||||
|
|
||||||
X=$(./yq e --output-format=props test.yml)
|
X=$(./yq e --output-format=props test.yml)
|
||||||
@@ -86,13 +135,30 @@ EOM
|
|||||||
assertEquals "$expected" "$X"
|
assertEquals "$expected" "$X"
|
||||||
}
|
}
|
||||||
|
|
||||||
testOutputPropertiesShort() {
|
testOutputPropertiesDontUnwrap() {
|
||||||
cat >test.yml <<EOL
|
cat >test.yml <<EOL
|
||||||
a: {b: {c: ["cat"]}}
|
a: {b: {c: ["cat cat"]}}
|
||||||
EOL
|
EOL
|
||||||
|
|
||||||
read -r -d '' expected << EOM
|
read -r -d '' expected << EOM
|
||||||
a.b.c.0 = cat
|
a.b.c.0 = "cat cat"
|
||||||
|
EOM
|
||||||
|
|
||||||
|
X=$(./yq e -r=false --output-format=props test.yml)
|
||||||
|
assertEquals "$expected" "$X"
|
||||||
|
|
||||||
|
X=$(./yq ea -r=false --output-format=props test.yml)
|
||||||
|
assertEquals "$expected" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
testOutputPropertiesShort() {
|
||||||
|
cat >test.yml <<EOL
|
||||||
|
a: {b: {c: ["cat cat"]}}
|
||||||
|
EOL
|
||||||
|
|
||||||
|
read -r -d '' expected << EOM
|
||||||
|
a.b.c.0 = cat cat
|
||||||
EOM
|
EOM
|
||||||
|
|
||||||
X=$(./yq e -o=p test.yml)
|
X=$(./yq e -o=p test.yml)
|
||||||
@@ -102,4 +168,107 @@ EOM
|
|||||||
assertEquals "$expected" "$X"
|
assertEquals "$expected" "$X"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
testOutputCSV() {
|
||||||
|
cat >test.yml <<EOL
|
||||||
|
- fruit: apple
|
||||||
|
yumLevel: 5
|
||||||
|
- fruit: banana
|
||||||
|
yumLevel: 4
|
||||||
|
EOL
|
||||||
|
|
||||||
|
read -r -d '' expected << EOM
|
||||||
|
fruit,yumLevel
|
||||||
|
apple,5
|
||||||
|
banana,4
|
||||||
|
EOM
|
||||||
|
|
||||||
|
X=$(./yq -o=c test.yml)
|
||||||
|
assertEquals "$expected" "$X"
|
||||||
|
|
||||||
|
X=$(./yq ea -o=csv test.yml)
|
||||||
|
assertEquals "$expected" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
testOutputTSV() {
|
||||||
|
cat >test.yml <<EOL
|
||||||
|
- fruit: apple
|
||||||
|
yumLevel: 5
|
||||||
|
- fruit: banana
|
||||||
|
yumLevel: 4
|
||||||
|
EOL
|
||||||
|
|
||||||
|
read -r -d '' expected << EOM
|
||||||
|
fruit yumLevel
|
||||||
|
apple 5
|
||||||
|
banana 4
|
||||||
|
EOM
|
||||||
|
|
||||||
|
X=$(./yq -o=t test.yml)
|
||||||
|
assertEquals "$expected" "$X"
|
||||||
|
|
||||||
|
X=$(./yq ea -o=tsv test.yml)
|
||||||
|
assertEquals "$expected" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
testOutputXml() {
|
||||||
|
cat >test.yml <<EOL
|
||||||
|
a: {b: {c: ["cat"]}}
|
||||||
|
EOL
|
||||||
|
|
||||||
|
read -r -d '' expected << EOM
|
||||||
|
<a>
|
||||||
|
<b>
|
||||||
|
<c>cat</c>
|
||||||
|
</b>
|
||||||
|
</a>
|
||||||
|
EOM
|
||||||
|
|
||||||
|
X=$(./yq e --output-format=xml test.yml)
|
||||||
|
assertEquals "$expected" "$X"
|
||||||
|
|
||||||
|
X=$(./yq ea --output-format=xml test.yml)
|
||||||
|
assertEquals "$expected" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
testOutputXmlShort() {
|
||||||
|
cat >test.yml <<EOL
|
||||||
|
a: {b: {c: ["cat"]}}
|
||||||
|
EOL
|
||||||
|
|
||||||
|
read -r -d '' expected << EOM
|
||||||
|
<a>
|
||||||
|
<b>
|
||||||
|
<c>cat</c>
|
||||||
|
</b>
|
||||||
|
</a>
|
||||||
|
EOM
|
||||||
|
|
||||||
|
X=$(./yq e --output-format=x test.yml)
|
||||||
|
assertEquals "$expected" "$X"
|
||||||
|
|
||||||
|
X=$(./yq ea --output-format=x test.yml)
|
||||||
|
assertEquals "$expected" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
testOutputXmComplex() {
|
||||||
|
cat >test.yml <<EOL
|
||||||
|
a: {b: {c: ["cat", "dog"], +@f: meow}}
|
||||||
|
EOL
|
||||||
|
|
||||||
|
read -r -d '' expected << EOM
|
||||||
|
<a>
|
||||||
|
<b f="meow">
|
||||||
|
<c>cat</c>
|
||||||
|
<c>dog</c>
|
||||||
|
</b>
|
||||||
|
</a>
|
||||||
|
EOM
|
||||||
|
|
||||||
|
X=$(./yq e --output-format=x test.yml)
|
||||||
|
assertEquals "$expected" "$X"
|
||||||
|
|
||||||
|
X=$(./yq ea --output-format=x test.yml)
|
||||||
|
assertEquals "$expected" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
source ./scripts/shunit2
|
source ./scripts/shunit2
|
||||||
Executable
+70
@@ -0,0 +1,70 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
setUp() {
|
||||||
|
rm test*.yml || true
|
||||||
|
cat >test.yml <<EOL
|
||||||
|
a: frog
|
||||||
|
EOL
|
||||||
|
}
|
||||||
|
|
||||||
|
testPipeViaCatWithParam() {
|
||||||
|
X=$(cat test.yml | ./yq '.a')
|
||||||
|
assertEquals "frog" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
testPipeViaCatWithParamEval() {
|
||||||
|
X=$(cat test.yml | ./yq e '.a')
|
||||||
|
assertEquals "frog" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
testPipeViaCatWithParamEvalAll() {
|
||||||
|
X=$(cat test.yml | ./yq ea '.a')
|
||||||
|
assertEquals "frog" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
testPipeViaCatNoParam() {
|
||||||
|
X=$(cat test.yml | ./yq)
|
||||||
|
assertEquals "a: frog" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
testPipeViaCatNoParamEval() {
|
||||||
|
X=$(cat test.yml | ./yq e)
|
||||||
|
assertEquals "a: frog" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
testPipeViaCatNoParamEvalAll() {
|
||||||
|
X=$(cat test.yml | ./yq ea)
|
||||||
|
assertEquals "a: frog" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
testPipeViaFileishWithParam() {
|
||||||
|
X=$(./yq '.a' < test.yml)
|
||||||
|
assertEquals "frog" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
testPipeViaFileishWithParamEval() {
|
||||||
|
X=$(./yq e '.a' < test.yml)
|
||||||
|
assertEquals "frog" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
testPipeViaFileishWithParamEvalAll() {
|
||||||
|
X=$(./yq ea '.a' < test.yml)
|
||||||
|
assertEquals "frog" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
testPipeViaFileishNoParam() {
|
||||||
|
X=$(./yq < test.yml)
|
||||||
|
assertEquals "a: frog" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
testPipeViaFileishNoParamEval() {
|
||||||
|
X=$(./yq e < test.yml)
|
||||||
|
assertEquals "a: frog" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
testPipeViaFileishNoParamEvalAll() {
|
||||||
|
X=$(./yq ea < test.yml)
|
||||||
|
assertEquals "a: frog" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
source ./scripts/shunit2
|
||||||
@@ -25,6 +25,56 @@ EOM
|
|||||||
assertEquals "$expectedDoc2" "$doc2"
|
assertEquals "$expectedDoc2" "$doc2"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
testBasicSplitWithNameCustomExtension() {
|
||||||
|
rm test*.yaml || true
|
||||||
|
cat >test.yml <<EOL
|
||||||
|
a: test_doc1
|
||||||
|
---
|
||||||
|
a: test_doc2
|
||||||
|
EOL
|
||||||
|
|
||||||
|
./yq e test.yml -s '.a + ".yaml"'
|
||||||
|
|
||||||
|
doc1=$(cat test_doc1.yaml)
|
||||||
|
|
||||||
|
assertEquals "a: test_doc1" "$doc1"
|
||||||
|
|
||||||
|
doc2=$(cat test_doc2.yaml)
|
||||||
|
read -r -d '' expectedDoc2 << EOM
|
||||||
|
---
|
||||||
|
a: test_doc2
|
||||||
|
EOM
|
||||||
|
assertEquals "$expectedDoc2" "$doc2"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
testSplitFromFile() {
|
||||||
|
cat >test.yml <<EOL
|
||||||
|
a: test_doc1
|
||||||
|
---
|
||||||
|
a: test_doc2
|
||||||
|
EOL
|
||||||
|
|
||||||
|
cat >test_splitExp.yml <<EOL
|
||||||
|
.a
|
||||||
|
EOL
|
||||||
|
|
||||||
|
./yq test.yml --split-exp-file test_splitExp.yml
|
||||||
|
|
||||||
|
doc1=$(cat test_doc1.yml)
|
||||||
|
|
||||||
|
assertEquals "a: test_doc1" "$doc1"
|
||||||
|
|
||||||
|
doc2=$(cat test_doc2.yml)
|
||||||
|
read -r -d '' expectedDoc2 << EOM
|
||||||
|
---
|
||||||
|
a: test_doc2
|
||||||
|
EOM
|
||||||
|
assertEquals "$expectedDoc2" "$doc2"
|
||||||
|
}
|
||||||
|
|
||||||
testBasicSplitWithNameEvalAll() {
|
testBasicSplitWithNameEvalAll() {
|
||||||
cat >test.yml <<EOL
|
cat >test.yml <<EOL
|
||||||
a: test_doc1
|
a: test_doc1
|
||||||
|
|||||||
+1
-1
@@ -12,6 +12,6 @@ outputs:
|
|||||||
description: "The complete result from the yq command being run"
|
description: "The complete result from the yq command being run"
|
||||||
runs:
|
runs:
|
||||||
using: 'docker'
|
using: 'docker'
|
||||||
image: 'github-action/Dockerfile'
|
image: 'docker://mikefarah/yq:4-githubaction'
|
||||||
args:
|
args:
|
||||||
- ${{ inputs.cmd }}
|
- ${{ inputs.cmd }}
|
||||||
|
|||||||
@@ -1,83 +0,0 @@
|
|||||||
package cmd
|
|
||||||
|
|
||||||
// import (
|
|
||||||
// "strings"
|
|
||||||
// "testing"
|
|
||||||
|
|
||||||
// "github.com/mikefarah/yq/v3/test"
|
|
||||||
// "github.com/spf13/cobra"
|
|
||||||
// )
|
|
||||||
|
|
||||||
// func getRootCommand() *cobra.Command {
|
|
||||||
// return New()
|
|
||||||
// }
|
|
||||||
|
|
||||||
// func TestRootCmd(t *testing.T) {
|
|
||||||
// cmd := getRootCommand()
|
|
||||||
// result := test.RunCmd(cmd, "")
|
|
||||||
// if result.Error != nil {
|
|
||||||
// t.Error(result.Error)
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if !strings.Contains(result.Output, "Usage:") {
|
|
||||||
// t.Error("Expected usage message to be printed out, but the usage message was not found.")
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// func TestRootCmd_Help(t *testing.T) {
|
|
||||||
// cmd := getRootCommand()
|
|
||||||
// result := test.RunCmd(cmd, "--help")
|
|
||||||
// if result.Error != nil {
|
|
||||||
// t.Error(result.Error)
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if !strings.Contains(result.Output, "yq is a lightweight and portable command-line YAML processor. It aims to be the jq or sed of yaml files.") {
|
|
||||||
// t.Error("Expected usage message to be printed out, but the usage message was not found.")
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// func TestRootCmd_VerboseLong(t *testing.T) {
|
|
||||||
// cmd := getRootCommand()
|
|
||||||
// result := test.RunCmd(cmd, "--verbose")
|
|
||||||
// if result.Error != nil {
|
|
||||||
// t.Error(result.Error)
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if !verbose {
|
|
||||||
// t.Error("Expected verbose to be true")
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// func TestRootCmd_VerboseShort(t *testing.T) {
|
|
||||||
// cmd := getRootCommand()
|
|
||||||
// result := test.RunCmd(cmd, "-v")
|
|
||||||
// if result.Error != nil {
|
|
||||||
// t.Error(result.Error)
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if !verbose {
|
|
||||||
// t.Error("Expected verbose to be true")
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// func TestRootCmd_VersionShort(t *testing.T) {
|
|
||||||
// cmd := getRootCommand()
|
|
||||||
// result := test.RunCmd(cmd, "-V")
|
|
||||||
// if result.Error != nil {
|
|
||||||
// t.Error(result.Error)
|
|
||||||
// }
|
|
||||||
// if !strings.Contains(result.Output, "yq version") {
|
|
||||||
// t.Error("expected version message to be printed out, but the message was not found.")
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// func TestRootCmd_VersionLong(t *testing.T) {
|
|
||||||
// cmd := getRootCommand()
|
|
||||||
// result := test.RunCmd(cmd, "--version")
|
|
||||||
// if result.Error != nil {
|
|
||||||
// t.Error(result.Error)
|
|
||||||
// }
|
|
||||||
// if !strings.Contains(result.Output, "yq version") {
|
|
||||||
// t.Error("expected version message to be printed out, but the message was not found.")
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
+8
-5
@@ -1,16 +1,14 @@
|
|||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
var leadingContentPreProcessing = true
|
var unwrapScalarFlag = newUnwrapFlag()
|
||||||
var unwrapScalar = true
|
|
||||||
|
var unwrapScalar = false
|
||||||
|
|
||||||
var writeInplace = false
|
var writeInplace = false
|
||||||
var outputToJSON = false
|
var outputToJSON = false
|
||||||
var outputFormat = "yaml"
|
var outputFormat = "yaml"
|
||||||
var inputFormat = "yaml"
|
var inputFormat = "yaml"
|
||||||
|
|
||||||
var xmlAttributePrefix = "+"
|
|
||||||
var xmlContentName = "+content"
|
|
||||||
|
|
||||||
var exitStatus = false
|
var exitStatus = false
|
||||||
var forceColor = false
|
var forceColor = false
|
||||||
var forceNoColor = false
|
var forceNoColor = false
|
||||||
@@ -26,5 +24,10 @@ var prettyPrint = false
|
|||||||
var frontMatter = ""
|
var frontMatter = ""
|
||||||
|
|
||||||
var splitFileExp = ""
|
var splitFileExp = ""
|
||||||
|
var splitFileExpFile = ""
|
||||||
|
|
||||||
var completedSuccessfully = false
|
var completedSuccessfully = false
|
||||||
|
|
||||||
|
var forceExpression = ""
|
||||||
|
|
||||||
|
var expressionFile = ""
|
||||||
|
|||||||
+21
-22
@@ -2,7 +2,6 @@ package cmd
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"os"
|
|
||||||
|
|
||||||
"github.com/mikefarah/yq/v4/pkg/yqlib"
|
"github.com/mikefarah/yq/v4/pkg/yqlib"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
@@ -39,7 +38,7 @@ Note that it consumes more memory than eval.
|
|||||||
}
|
}
|
||||||
return cmdEvalAll
|
return cmdEvalAll
|
||||||
}
|
}
|
||||||
func evaluateAll(cmd *cobra.Command, args []string) error {
|
func evaluateAll(cmd *cobra.Command, args []string) (cmdError error) {
|
||||||
// 0 args, read std in
|
// 0 args, read std in
|
||||||
// 1 arg, null input, process expression
|
// 1 arg, null input, process expression
|
||||||
// 1 arg, read file in sequence
|
// 1 arg, read file in sequence
|
||||||
@@ -47,27 +46,28 @@ func evaluateAll(cmd *cobra.Command, args []string) error {
|
|||||||
|
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
firstFileIndex, err := initCommand(cmd, args)
|
expression, args, err := initCommand(cmd, args)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
stat, _ := os.Stdin.Stat()
|
|
||||||
pipingStdIn := (stat.Mode() & os.ModeCharDevice) == 0
|
|
||||||
|
|
||||||
out := cmd.OutOrStdout()
|
out := cmd.OutOrStdout()
|
||||||
|
|
||||||
if writeInplace {
|
if writeInplace {
|
||||||
// only use colors if its forced
|
// only use colors if its forced
|
||||||
colorsEnabled = forceColor
|
colorsEnabled = forceColor
|
||||||
writeInPlaceHandler := yqlib.NewWriteInPlaceHandler(args[firstFileIndex])
|
writeInPlaceHandler := yqlib.NewWriteInPlaceHandler(args[0])
|
||||||
out, err = writeInPlaceHandler.CreateTempFile()
|
out, err = writeInPlaceHandler.CreateTempFile()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// need to indirectly call the function so that completedSuccessfully is
|
// need to indirectly call the function so that completedSuccessfully is
|
||||||
// passed when we finish execution as opposed to now
|
// passed when we finish execution as opposed to now
|
||||||
defer func() { writeInPlaceHandler.FinishWriteInPlace(completedSuccessfully) }()
|
defer func() {
|
||||||
|
if cmdError == nil {
|
||||||
|
cmdError = writeInPlaceHandler.FinishWriteInPlace(completedSuccessfully)
|
||||||
|
}
|
||||||
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
format, err := yqlib.OutputFormatFromString(outputFormat)
|
format, err := yqlib.OutputFormatFromString(outputFormat)
|
||||||
@@ -75,22 +75,26 @@ func evaluateAll(cmd *cobra.Command, args []string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
decoder, err := configureDecoder()
|
decoder, err := configureDecoder(true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
printerWriter := configurePrinterWriter(format, out)
|
printerWriter, err := configurePrinterWriter(format, out)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
encoder := configureEncoder(format)
|
||||||
|
|
||||||
printer := yqlib.NewPrinter(printerWriter, format, unwrapScalar, colorsEnabled, indent, !noDocSeparators)
|
printer := yqlib.NewPrinter(encoder, printerWriter)
|
||||||
|
|
||||||
if frontMatter != "" {
|
if frontMatter != "" {
|
||||||
frontMatterHandler := yqlib.NewFrontMatterHandler(args[firstFileIndex])
|
frontMatterHandler := yqlib.NewFrontMatterHandler(args[0])
|
||||||
err = frontMatterHandler.Split()
|
err = frontMatterHandler.Split()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
args[firstFileIndex] = frontMatterHandler.GetYamlFrontMatterFilename()
|
args[0] = frontMatterHandler.GetYamlFrontMatterFilename()
|
||||||
|
|
||||||
if frontMatter == "process" {
|
if frontMatter == "process" {
|
||||||
reader := frontMatterHandler.GetContentReader()
|
reader := frontMatterHandler.GetContentReader()
|
||||||
@@ -101,22 +105,17 @@ func evaluateAll(cmd *cobra.Command, args []string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
allAtOnceEvaluator := yqlib.NewAllAtOnceEvaluator()
|
allAtOnceEvaluator := yqlib.NewAllAtOnceEvaluator()
|
||||||
|
|
||||||
switch len(args) {
|
switch len(args) {
|
||||||
case 0:
|
case 0:
|
||||||
if pipingStdIn {
|
if nullInput {
|
||||||
err = allAtOnceEvaluator.EvaluateFiles(processExpression(""), []string{"-"}, printer, leadingContentPreProcessing, decoder)
|
err = yqlib.NewStreamEvaluator().EvaluateNew(processExpression(expression), printer)
|
||||||
} else {
|
} else {
|
||||||
cmd.Println(cmd.UsageString())
|
cmd.Println(cmd.UsageString())
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
case 1:
|
|
||||||
if nullInput {
|
|
||||||
err = yqlib.NewStreamEvaluator().EvaluateNew(processExpression(args[0]), printer, "")
|
|
||||||
} else {
|
|
||||||
err = allAtOnceEvaluator.EvaluateFiles(processExpression(""), []string{args[0]}, printer, leadingContentPreProcessing, decoder)
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
err = allAtOnceEvaluator.EvaluateFiles(processExpression(args[0]), args[1:], printer, leadingContentPreProcessing, decoder)
|
err = allAtOnceEvaluator.EvaluateFiles(processExpression(expression), args, printer, decoder)
|
||||||
}
|
}
|
||||||
|
|
||||||
completedSuccessfully = err == nil
|
completedSuccessfully = err == nil
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package cmd
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
|
|
||||||
"github.com/mikefarah/yq/v4/pkg/yqlib"
|
"github.com/mikefarah/yq/v4/pkg/yqlib"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
@@ -13,7 +12,7 @@ func createEvaluateSequenceCommand() *cobra.Command {
|
|||||||
var cmdEvalSequence = &cobra.Command{
|
var cmdEvalSequence = &cobra.Command{
|
||||||
Use: "eval [expression] [yaml_file1]...",
|
Use: "eval [expression] [yaml_file1]...",
|
||||||
Aliases: []string{"e"},
|
Aliases: []string{"e"},
|
||||||
Short: "Apply the expression to each document in each yaml file in sequence",
|
Short: "(default) Apply the expression to each document in each yaml file in sequence",
|
||||||
Example: `
|
Example: `
|
||||||
# Reads field under the given path for each file
|
# Reads field under the given path for each file
|
||||||
yq e '.a.b' f1.yml f2.yml
|
yq e '.a.b' f1.yml f2.yml
|
||||||
@@ -44,43 +43,45 @@ expression and prints the result in sequence.`,
|
|||||||
}
|
}
|
||||||
|
|
||||||
func processExpression(expression string) string {
|
func processExpression(expression string) string {
|
||||||
var prettyPrintExp = `(... | (select(tag != "!!str"), select(tag == "!!str") | select(test("(?i)^(y|yes|n|no|on|off)$") | not)) ) style=""`
|
|
||||||
if prettyPrint && expression == "" {
|
if prettyPrint && expression == "" {
|
||||||
return prettyPrintExp
|
return yqlib.PrettyPrintExp
|
||||||
} else if prettyPrint {
|
} else if prettyPrint {
|
||||||
return fmt.Sprintf("%v | %v", expression, prettyPrintExp)
|
return fmt.Sprintf("%v | %v", expression, yqlib.PrettyPrintExp)
|
||||||
}
|
}
|
||||||
return expression
|
return expression
|
||||||
}
|
}
|
||||||
|
|
||||||
func evaluateSequence(cmd *cobra.Command, args []string) error {
|
func evaluateSequence(cmd *cobra.Command, args []string) (cmdError error) {
|
||||||
// 0 args, read std in
|
// 0 args, read std in
|
||||||
// 1 arg, null input, process expression
|
// 1 arg, null input, process expression
|
||||||
// 1 arg, read file in sequence
|
// 1 arg, read file in sequence
|
||||||
// 2+ args, [0] = expression, file the rest
|
// 2+ args, [0] = expression, file the rest
|
||||||
|
|
||||||
|
out := cmd.OutOrStdout()
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
firstFileIndex, err := initCommand(cmd, args)
|
|
||||||
|
expression, args, err := initCommand(cmd, args)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
stat, _ := os.Stdin.Stat()
|
|
||||||
pipingStdIn := (stat.Mode() & os.ModeCharDevice) == 0
|
|
||||||
|
|
||||||
out := cmd.OutOrStdout()
|
|
||||||
|
|
||||||
if writeInplace {
|
if writeInplace {
|
||||||
// only use colors if its forced
|
// only use colors if its forced
|
||||||
colorsEnabled = forceColor
|
colorsEnabled = forceColor
|
||||||
writeInPlaceHandler := yqlib.NewWriteInPlaceHandler(args[firstFileIndex])
|
writeInPlaceHandler := yqlib.NewWriteInPlaceHandler(args[0])
|
||||||
out, err = writeInPlaceHandler.CreateTempFile()
|
out, err = writeInPlaceHandler.CreateTempFile()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// need to indirectly call the function so that completedSuccessfully is
|
// need to indirectly call the function so that completedSuccessfully is
|
||||||
// passed when we finish execution as opposed to now
|
// passed when we finish execution as opposed to now
|
||||||
defer func() { writeInPlaceHandler.FinishWriteInPlace(completedSuccessfully) }()
|
defer func() {
|
||||||
|
if cmdError == nil {
|
||||||
|
cmdError = writeInPlaceHandler.FinishWriteInPlace(completedSuccessfully)
|
||||||
|
}
|
||||||
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
format, err := yqlib.OutputFormatFromString(outputFormat)
|
format, err := yqlib.OutputFormatFromString(outputFormat)
|
||||||
@@ -88,24 +89,28 @@ func evaluateSequence(cmd *cobra.Command, args []string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
printerWriter := configurePrinterWriter(format, out)
|
printerWriter, err := configurePrinterWriter(format, out)
|
||||||
|
|
||||||
printer := yqlib.NewPrinter(printerWriter, format, unwrapScalar, colorsEnabled, indent, !noDocSeparators)
|
|
||||||
|
|
||||||
decoder, err := configureDecoder()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
encoder := configureEncoder(format)
|
||||||
|
|
||||||
|
printer := yqlib.NewPrinter(encoder, printerWriter)
|
||||||
|
|
||||||
|
decoder, err := configureDecoder(false)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
streamEvaluator := yqlib.NewStreamEvaluator()
|
streamEvaluator := yqlib.NewStreamEvaluator()
|
||||||
|
|
||||||
if frontMatter != "" {
|
if frontMatter != "" {
|
||||||
frontMatterHandler := yqlib.NewFrontMatterHandler(args[firstFileIndex])
|
yqlib.GetLogger().Debug("using front matter handler")
|
||||||
|
frontMatterHandler := yqlib.NewFrontMatterHandler(args[0])
|
||||||
err = frontMatterHandler.Split()
|
err = frontMatterHandler.Split()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
args[firstFileIndex] = frontMatterHandler.GetYamlFrontMatterFilename()
|
args[0] = frontMatterHandler.GetYamlFrontMatterFilename()
|
||||||
|
|
||||||
if frontMatter == "process" {
|
if frontMatter == "process" {
|
||||||
reader := frontMatterHandler.GetContentReader()
|
reader := frontMatterHandler.GetContentReader()
|
||||||
@@ -117,20 +122,14 @@ func evaluateSequence(cmd *cobra.Command, args []string) error {
|
|||||||
|
|
||||||
switch len(args) {
|
switch len(args) {
|
||||||
case 0:
|
case 0:
|
||||||
if pipingStdIn {
|
if nullInput {
|
||||||
err = streamEvaluator.EvaluateFiles(processExpression(""), []string{"-"}, printer, leadingContentPreProcessing, decoder)
|
err = streamEvaluator.EvaluateNew(processExpression(expression), printer)
|
||||||
} else {
|
} else {
|
||||||
cmd.Println(cmd.UsageString())
|
cmd.Println(cmd.UsageString())
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
case 1:
|
|
||||||
if nullInput {
|
|
||||||
err = streamEvaluator.EvaluateNew(processExpression(args[0]), printer, "")
|
|
||||||
} else {
|
|
||||||
err = streamEvaluator.EvaluateFiles(processExpression(""), []string{args[0]}, printer, leadingContentPreProcessing, decoder)
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
err = streamEvaluator.EvaluateFiles(processExpression(args[0]), args[1:], printer, leadingContentPreProcessing, decoder)
|
err = streamEvaluator.EvaluateFiles(processExpression(expression), args, printer, decoder)
|
||||||
}
|
}
|
||||||
completedSuccessfully = err == nil
|
completedSuccessfully = err == nil
|
||||||
|
|
||||||
|
|||||||
+60
-14
@@ -14,17 +14,30 @@ func New() *cobra.Command {
|
|||||||
Short: "yq is a lightweight and portable command-line YAML processor.",
|
Short: "yq is a lightweight and portable command-line YAML processor.",
|
||||||
Long: `yq is a portable command-line YAML processor (https://github.com/mikefarah/yq/)
|
Long: `yq is a portable command-line YAML processor (https://github.com/mikefarah/yq/)
|
||||||
See https://mikefarah.gitbook.io/yq/ for detailed documentation and examples.`,
|
See https://mikefarah.gitbook.io/yq/ for detailed documentation and examples.`,
|
||||||
|
Example: `
|
||||||
|
# yq defaults to 'eval' command if no command is specified. See "yq eval --help" for more examples.
|
||||||
|
|
||||||
|
# read the "stuff" node from "myfile.yml"
|
||||||
|
yq '.stuff' < myfile.yml
|
||||||
|
|
||||||
|
# update myfile.yml in place
|
||||||
|
yq -i '.stuff = "foo"' myfile.yml
|
||||||
|
|
||||||
|
# print contents of sample.json as idiomatic YAML
|
||||||
|
yq -P sample.json
|
||||||
|
`,
|
||||||
|
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
if version {
|
if version {
|
||||||
cmd.Print(GetVersionDisplay())
|
cmd.Print(GetVersionDisplay())
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
cmd.Println(cmd.UsageString())
|
return evaluateSequence(cmd, args)
|
||||||
return nil
|
|
||||||
|
|
||||||
},
|
},
|
||||||
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
|
||||||
cmd.SetOut(cmd.OutOrStdout())
|
cmd.SetOut(cmd.OutOrStdout())
|
||||||
|
|
||||||
var format = logging.MustStringFormatter(
|
var format = logging.MustStringFormatter(
|
||||||
`%{color}%{time:15:04:05} %{shortfunc} [%{level:.4s}]%{color:reset} %{message}`,
|
`%{color}%{time:15:04:05} %{shortfunc} [%{level:.4s}]%{color:reset} %{message}`,
|
||||||
)
|
)
|
||||||
@@ -34,12 +47,32 @@ See https://mikefarah.gitbook.io/yq/ for detailed documentation and examples.`,
|
|||||||
if verbose {
|
if verbose {
|
||||||
backend.SetLevel(logging.DEBUG, "")
|
backend.SetLevel(logging.DEBUG, "")
|
||||||
} else {
|
} else {
|
||||||
backend.SetLevel(logging.ERROR, "")
|
backend.SetLevel(logging.WARNING, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
logging.SetBackend(backend)
|
logging.SetBackend(backend)
|
||||||
yqlib.XmlPreferences.AttributePrefix = xmlAttributePrefix
|
yqlib.InitExpressionParser()
|
||||||
yqlib.XmlPreferences.ContentName = xmlContentName
|
|
||||||
|
outputFormatType, err := yqlib.OutputFormatFromString(outputFormat)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if outputFormatType == yqlib.YamlOutputFormat ||
|
||||||
|
outputFormatType == yqlib.PropsOutputFormat {
|
||||||
|
unwrapScalar = true
|
||||||
|
}
|
||||||
|
if unwrapScalarFlag.IsExplicitySet() {
|
||||||
|
unwrapScalar = unwrapScalarFlag.IsSet()
|
||||||
|
}
|
||||||
|
|
||||||
|
//copy preference form global setting
|
||||||
|
yqlib.ConfiguredYamlPreferences.UnwrapScalar = unwrapScalar
|
||||||
|
|
||||||
|
yqlib.ConfiguredYamlPreferences.PrintDocSeparators = !noDocSeparators
|
||||||
|
|
||||||
|
return nil
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,28 +84,41 @@ See https://mikefarah.gitbook.io/yq/ for detailed documentation and examples.`,
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
rootCmd.PersistentFlags().StringVarP(&outputFormat, "output-format", "o", "yaml", "[yaml|y|json|j|props|p] output format type.")
|
rootCmd.PersistentFlags().StringVarP(&outputFormat, "output-format", "o", "yaml", "[yaml|y|json|j|props|p|xml|x] output format type.")
|
||||||
rootCmd.PersistentFlags().StringVarP(&inputFormat, "input-format", "p", "yaml", "[yaml|y|xml|x] input format type.")
|
rootCmd.PersistentFlags().StringVarP(&inputFormat, "input-format", "p", "yaml", "[yaml|y|props|p|xml|x] parse format for input. Note that json is a subset of yaml.")
|
||||||
|
|
||||||
rootCmd.PersistentFlags().StringVar(&xmlAttributePrefix, "xml-attribute-prefix", "+", "prefix for xml attributes")
|
rootCmd.PersistentFlags().StringVar(&yqlib.ConfiguredXMLPreferences.AttributePrefix, "xml-attribute-prefix", yqlib.ConfiguredXMLPreferences.AttributePrefix, "prefix for xml attributes")
|
||||||
rootCmd.PersistentFlags().StringVar(&xmlContentName, "xml-content-name", "+content", "name for xml content (if no attribute name is present).")
|
rootCmd.PersistentFlags().StringVar(&yqlib.ConfiguredXMLPreferences.ContentName, "xml-content-name", yqlib.ConfiguredXMLPreferences.ContentName, "name for xml content (if no attribute name is present).")
|
||||||
|
rootCmd.PersistentFlags().BoolVar(&yqlib.ConfiguredXMLPreferences.StrictMode, "xml-strict-mode", yqlib.ConfiguredXMLPreferences.StrictMode, "enables strict parsing of XML. See https://pkg.go.dev/encoding/xml for more details.")
|
||||||
|
rootCmd.PersistentFlags().BoolVar(&yqlib.ConfiguredXMLPreferences.KeepNamespace, "xml-keep-namespace", yqlib.ConfiguredXMLPreferences.KeepNamespace, "enables keeping namespace after parsing attributes")
|
||||||
|
rootCmd.PersistentFlags().BoolVar(&yqlib.ConfiguredXMLPreferences.UseRawToken, "xml-raw-token", yqlib.ConfiguredXMLPreferences.UseRawToken, "enables using RawToken method instead Token. Commonly disables namespace translations. See https://pkg.go.dev/encoding/xml#Decoder.RawToken for details.")
|
||||||
|
rootCmd.PersistentFlags().StringVar(&yqlib.ConfiguredXMLPreferences.ProcInstPrefix, "xml-proc-inst-prefix", yqlib.ConfiguredXMLPreferences.ProcInstPrefix, "prefix for xml processing instructions (e.g. <?xml version=\"1\"?>)")
|
||||||
|
rootCmd.PersistentFlags().StringVar(&yqlib.ConfiguredXMLPreferences.DirectiveName, "xml-directive-name", yqlib.ConfiguredXMLPreferences.DirectiveName, "name for xml directives (e.g. <!DOCTYPE thing cat>)")
|
||||||
|
rootCmd.PersistentFlags().BoolVar(&yqlib.ConfiguredXMLPreferences.SkipProcInst, "xml-skip-proc-inst", yqlib.ConfiguredXMLPreferences.SkipProcInst, "skip over process instructions (e.g. <?xml version=\"1\"?>)")
|
||||||
|
rootCmd.PersistentFlags().BoolVar(&yqlib.ConfiguredXMLPreferences.SkipDirectives, "xml-skip-directives", yqlib.ConfiguredXMLPreferences.SkipDirectives, "skip over directives (e.g. <!DOCTYPE thing cat>)")
|
||||||
|
|
||||||
rootCmd.PersistentFlags().BoolVarP(&nullInput, "null-input", "n", false, "Don't read input, simply evaluate the expression given. Useful for creating yaml docs from scratch.")
|
rootCmd.PersistentFlags().BoolVarP(&nullInput, "null-input", "n", false, "Don't read input, simply evaluate the expression given. Useful for creating docs from scratch.")
|
||||||
rootCmd.PersistentFlags().BoolVarP(&noDocSeparators, "no-doc", "N", false, "Don't print document separators (---)")
|
rootCmd.PersistentFlags().BoolVarP(&noDocSeparators, "no-doc", "N", false, "Don't print document separators (---)")
|
||||||
|
|
||||||
rootCmd.PersistentFlags().IntVarP(&indent, "indent", "I", 2, "sets indent level for output")
|
rootCmd.PersistentFlags().IntVarP(&indent, "indent", "I", 2, "sets indent level for output")
|
||||||
rootCmd.Flags().BoolVarP(&version, "version", "V", false, "Print version information and quit")
|
rootCmd.Flags().BoolVarP(&version, "version", "V", false, "Print version information and quit")
|
||||||
rootCmd.PersistentFlags().BoolVarP(&writeInplace, "inplace", "i", false, "update the yaml file inplace of first yaml file given.")
|
rootCmd.PersistentFlags().BoolVarP(&writeInplace, "inplace", "i", false, "update the file inplace of first file given.")
|
||||||
rootCmd.PersistentFlags().BoolVarP(&unwrapScalar, "unwrapScalar", "", true, "unwrap scalar, print the value with no quotes, colors or comments")
|
rootCmd.PersistentFlags().VarP(unwrapScalarFlag, "unwrapScalar", "r", "unwrap scalar, print the value with no quotes, colors or comments. Defaults to true for yaml")
|
||||||
|
rootCmd.PersistentFlags().Lookup("unwrapScalar").NoOptDefVal = "true"
|
||||||
|
|
||||||
rootCmd.PersistentFlags().BoolVarP(&prettyPrint, "prettyPrint", "P", false, "pretty print, shorthand for '... style = \"\"'")
|
rootCmd.PersistentFlags().BoolVarP(&prettyPrint, "prettyPrint", "P", false, "pretty print, shorthand for '... style = \"\"'")
|
||||||
rootCmd.PersistentFlags().BoolVarP(&exitStatus, "exit-status", "e", false, "set exit status if there are no matches or null or false is returned")
|
rootCmd.PersistentFlags().BoolVarP(&exitStatus, "exit-status", "e", false, "set exit status if there are no matches or null or false is returned")
|
||||||
|
|
||||||
rootCmd.PersistentFlags().BoolVarP(&forceColor, "colors", "C", false, "force print with colors")
|
rootCmd.PersistentFlags().BoolVarP(&forceColor, "colors", "C", false, "force print with colors")
|
||||||
rootCmd.PersistentFlags().BoolVarP(&forceNoColor, "no-colors", "M", false, "force print with no colors")
|
rootCmd.PersistentFlags().BoolVarP(&forceNoColor, "no-colors", "M", false, "force print with no colors")
|
||||||
rootCmd.PersistentFlags().StringVarP(&frontMatter, "front-matter", "f", "", "(extract|process) first input as yaml front-matter. Extract will pull out the yaml content, process will run the expression against the yaml content, leaving the remaining data intact")
|
rootCmd.PersistentFlags().StringVarP(&frontMatter, "front-matter", "f", "", "(extract|process) first input as yaml front-matter. Extract will pull out the yaml content, process will run the expression against the yaml content, leaving the remaining data intact")
|
||||||
rootCmd.PersistentFlags().BoolVarP(&leadingContentPreProcessing, "header-preprocess", "", true, "Slurp any header comments and separators before processing expression. This is a workaround for go-yaml to persist header content properly.")
|
rootCmd.PersistentFlags().StringVarP(&forceExpression, "expression", "", "", "forcibly set the expression argument. Useful when yq argument detection thinks your expression is a file.")
|
||||||
|
rootCmd.PersistentFlags().BoolVarP(&yqlib.ConfiguredYamlPreferences.LeadingContentPreProcessing, "header-preprocess", "", true, "Slurp any header comments and separators before processing expression.")
|
||||||
|
|
||||||
rootCmd.PersistentFlags().StringVarP(&splitFileExp, "split-exp", "s", "", "print each result (or doc) into a file named (exp). [exp] argument must return a string. You can use $index in the expression as the result counter.")
|
rootCmd.PersistentFlags().StringVarP(&splitFileExp, "split-exp", "s", "", "print each result (or doc) into a file named (exp). [exp] argument must return a string. You can use $index in the expression as the result counter.")
|
||||||
|
rootCmd.PersistentFlags().StringVarP(&splitFileExpFile, "split-exp-file", "", "", "Use a file to specify the split-exp expression.")
|
||||||
|
|
||||||
|
rootCmd.PersistentFlags().StringVarP(&expressionFile, "from-file", "", "", "Load expression from specified file.")
|
||||||
|
|
||||||
rootCmd.AddCommand(
|
rootCmd.AddCommand(
|
||||||
createEvaluateSequenceCommand(),
|
createEvaluateSequenceCommand(),
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ $ yq shell-completion fish > ~/.config/fish/completions/yq.fish
|
|||||||
`,
|
`,
|
||||||
DisableFlagsInUseLine: true,
|
DisableFlagsInUseLine: true,
|
||||||
ValidArgs: []string{"bash", "zsh", "fish", "powershell"},
|
ValidArgs: []string{"bash", "zsh", "fish", "powershell"},
|
||||||
Args: cobra.ExactValidArgs(1),
|
Args: cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs),
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
var err error = nil
|
var err error = nil
|
||||||
switch args[0] {
|
switch args[0] {
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package cmd
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/spf13/pflag"
|
||||||
|
)
|
||||||
|
|
||||||
|
type boolFlag interface {
|
||||||
|
pflag.Value
|
||||||
|
IsExplicitySet() bool
|
||||||
|
IsSet() bool
|
||||||
|
}
|
||||||
|
|
||||||
|
type unwrapScalarFlagStrc struct {
|
||||||
|
explicitySet bool
|
||||||
|
value bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func newUnwrapFlag() boolFlag {
|
||||||
|
return &unwrapScalarFlagStrc{value: true}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *unwrapScalarFlagStrc) IsExplicitySet() bool {
|
||||||
|
return f.explicitySet
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *unwrapScalarFlagStrc) IsSet() bool {
|
||||||
|
return f.value
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *unwrapScalarFlagStrc) String() string {
|
||||||
|
return strconv.FormatBool(f.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *unwrapScalarFlagStrc) Set(value string) error {
|
||||||
|
|
||||||
|
v, err := strconv.ParseBool(value)
|
||||||
|
f.value = v
|
||||||
|
f.explicitySet = true
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*unwrapScalarFlagStrc) Type() string {
|
||||||
|
return "bool"
|
||||||
|
}
|
||||||
+123
-20
@@ -7,9 +7,10 @@ import (
|
|||||||
|
|
||||||
"github.com/mikefarah/yq/v4/pkg/yqlib"
|
"github.com/mikefarah/yq/v4/pkg/yqlib"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
"gopkg.in/op/go-logging.v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
func initCommand(cmd *cobra.Command, args []string) (firstFileIndex int, err error) {
|
func initCommand(cmd *cobra.Command, args []string) (string, []string, error) {
|
||||||
cmd.SilenceUsage = true
|
cmd.SilenceUsage = true
|
||||||
|
|
||||||
fileInfo, _ := os.Stdout.Stat()
|
fileInfo, _ := os.Stdout.Stat()
|
||||||
@@ -18,11 +19,17 @@ func initCommand(cmd *cobra.Command, args []string) (firstFileIndex int, err err
|
|||||||
colorsEnabled = true
|
colorsEnabled = true
|
||||||
}
|
}
|
||||||
|
|
||||||
firstFileIndex = -1
|
expression, args, err := processArgs(args)
|
||||||
if !nullInput && len(args) == 1 {
|
if err != nil {
|
||||||
firstFileIndex = 0
|
return "", nil, err
|
||||||
} else if len(args) > 1 {
|
}
|
||||||
firstFileIndex = 1
|
|
||||||
|
if splitFileExpFile != "" {
|
||||||
|
splitExpressionBytes, err := os.ReadFile(splitFileExpFile)
|
||||||
|
if err != nil {
|
||||||
|
return "", nil, err
|
||||||
|
}
|
||||||
|
splitFileExp = string(splitExpressionBytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
// backwards compatibility
|
// backwards compatibility
|
||||||
@@ -30,46 +37,142 @@ func initCommand(cmd *cobra.Command, args []string) (firstFileIndex int, err err
|
|||||||
outputFormat = "json"
|
outputFormat = "json"
|
||||||
}
|
}
|
||||||
|
|
||||||
if writeInplace && (firstFileIndex == -1) {
|
if writeInplace && (len(args) == 0 || args[0] == "-") {
|
||||||
return 0, fmt.Errorf("write inplace flag only applicable when giving an expression and at least one file")
|
return "", nil, fmt.Errorf("write inplace flag only applicable when giving an expression and at least one file")
|
||||||
|
}
|
||||||
|
|
||||||
|
if frontMatter != "" && len(args) == 0 {
|
||||||
|
return "", nil, fmt.Errorf("front matter flag only applicable when giving an expression and at least one file")
|
||||||
}
|
}
|
||||||
|
|
||||||
if writeInplace && splitFileExp != "" {
|
if writeInplace && splitFileExp != "" {
|
||||||
return 0, fmt.Errorf("write inplace cannot be used with split file")
|
return "", nil, fmt.Errorf("write inplace cannot be used with split file")
|
||||||
}
|
}
|
||||||
|
|
||||||
if nullInput && len(args) > 1 {
|
if nullInput && len(args) > 0 {
|
||||||
return 0, fmt.Errorf("cannot pass files in when using null-input flag")
|
return "", nil, fmt.Errorf("cannot pass files in when using null-input flag")
|
||||||
}
|
}
|
||||||
|
|
||||||
return firstFileIndex, nil
|
return expression, args, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func configureDecoder() (yqlib.Decoder, error) {
|
func configureDecoder(evaluateTogether bool) (yqlib.Decoder, error) {
|
||||||
yqlibInputFormat, err := yqlib.InputFormatFromString(inputFormat)
|
yqlibInputFormat, err := yqlib.InputFormatFromString(inputFormat)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
switch yqlibInputFormat {
|
switch yqlibInputFormat {
|
||||||
case yqlib.XmlInputFormat:
|
case yqlib.XMLInputFormat:
|
||||||
return yqlib.NewXmlDecoder(xmlAttributePrefix, xmlContentName), nil
|
return yqlib.NewXMLDecoder(yqlib.ConfiguredXMLPreferences), nil
|
||||||
|
case yqlib.PropertiesInputFormat:
|
||||||
|
return yqlib.NewPropertiesDecoder(), nil
|
||||||
|
case yqlib.JsonInputFormat:
|
||||||
|
return yqlib.NewJSONDecoder(), nil
|
||||||
|
case yqlib.CSVObjectInputFormat:
|
||||||
|
return yqlib.NewCSVObjectDecoder(','), nil
|
||||||
|
case yqlib.TSVObjectInputFormat:
|
||||||
|
return yqlib.NewCSVObjectDecoder('\t'), nil
|
||||||
}
|
}
|
||||||
return yqlib.NewYamlDecoder(), nil
|
prefs := yqlib.ConfiguredYamlPreferences
|
||||||
|
prefs.EvaluateTogether = evaluateTogether
|
||||||
|
return yqlib.NewYamlDecoder(prefs), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func configurePrinterWriter(format yqlib.PrinterOutputFormat, out io.Writer) yqlib.PrinterWriter {
|
func configurePrinterWriter(format yqlib.PrinterOutputFormat, out io.Writer) (yqlib.PrinterWriter, error) {
|
||||||
|
|
||||||
var printerWriter yqlib.PrinterWriter
|
var printerWriter yqlib.PrinterWriter
|
||||||
|
|
||||||
if splitFileExp != "" {
|
if splitFileExp != "" {
|
||||||
colorsEnabled = forceColor
|
colorsEnabled = forceColor
|
||||||
splitExp, err := yqlib.NewExpressionParser().ParseExpression(splitFileExp)
|
splitExp, err := yqlib.ExpressionParser.ParseExpression(splitFileExp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil
|
return nil, fmt.Errorf("bad split document expression: %w", err)
|
||||||
}
|
}
|
||||||
printerWriter = yqlib.NewMultiPrinterWriter(splitExp, format)
|
printerWriter = yqlib.NewMultiPrinterWriter(splitExp, format)
|
||||||
} else {
|
} else {
|
||||||
printerWriter = yqlib.NewSinglePrinterWriter(out)
|
printerWriter = yqlib.NewSinglePrinterWriter(out)
|
||||||
}
|
}
|
||||||
return printerWriter
|
return printerWriter, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func configureEncoder(format yqlib.PrinterOutputFormat) yqlib.Encoder {
|
||||||
|
switch format {
|
||||||
|
case yqlib.JSONOutputFormat:
|
||||||
|
return yqlib.NewJSONEncoder(indent, colorsEnabled, unwrapScalar)
|
||||||
|
case yqlib.PropsOutputFormat:
|
||||||
|
return yqlib.NewPropertiesEncoder(unwrapScalar)
|
||||||
|
case yqlib.CSVOutputFormat:
|
||||||
|
return yqlib.NewCsvEncoder(',')
|
||||||
|
case yqlib.TSVOutputFormat:
|
||||||
|
return yqlib.NewCsvEncoder('\t')
|
||||||
|
case yqlib.YamlOutputFormat:
|
||||||
|
return yqlib.NewYamlEncoder(indent, colorsEnabled, yqlib.ConfiguredYamlPreferences)
|
||||||
|
case yqlib.XMLOutputFormat:
|
||||||
|
return yqlib.NewXMLEncoder(indent, yqlib.ConfiguredXMLPreferences)
|
||||||
|
}
|
||||||
|
panic("invalid encoder")
|
||||||
|
}
|
||||||
|
|
||||||
|
// this is a hack to enable backwards compatibility with githubactions (which pipe /dev/null into everything)
|
||||||
|
// and being able to call yq with the filename as a single parameter
|
||||||
|
//
|
||||||
|
// without this - yq detects there is stdin (thanks githubactions),
|
||||||
|
// then tries to parse the filename as an expression
|
||||||
|
func maybeFile(str string) bool {
|
||||||
|
yqlib.GetLogger().Debugf("checking '%v' is a file", str)
|
||||||
|
stat, err := os.Stat(str) // #nosec
|
||||||
|
result := err == nil && !stat.IsDir()
|
||||||
|
if yqlib.GetLogger().IsEnabledFor(logging.DEBUG) {
|
||||||
|
if err != nil {
|
||||||
|
yqlib.GetLogger().Debugf("error: %v", err)
|
||||||
|
} else {
|
||||||
|
yqlib.GetLogger().Debugf("error: %v, dir: %v", err, stat.IsDir())
|
||||||
|
}
|
||||||
|
yqlib.GetLogger().Debugf("result: %v", result)
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
func processStdInArgs(args []string) []string {
|
||||||
|
stat, _ := os.Stdin.Stat()
|
||||||
|
pipingStdin := (stat.Mode() & os.ModeCharDevice) == 0
|
||||||
|
|
||||||
|
// if we've been given a file, don't automatically
|
||||||
|
// read from stdin.
|
||||||
|
// this happens if there is more than one argument
|
||||||
|
// or only one argument and its a file
|
||||||
|
if nullInput || !pipingStdin || len(args) > 1 || (len(args) > 0 && maybeFile(args[0])) {
|
||||||
|
return args
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, arg := range args {
|
||||||
|
if arg == "-" {
|
||||||
|
return args
|
||||||
|
}
|
||||||
|
}
|
||||||
|
yqlib.GetLogger().Debugf("missing '-', adding it to the end")
|
||||||
|
|
||||||
|
// we're piping from stdin, but there's no '-' arg
|
||||||
|
// lets add one to the end
|
||||||
|
return append(args, "-")
|
||||||
|
}
|
||||||
|
|
||||||
|
func processArgs(originalArgs []string) (string, []string, error) {
|
||||||
|
expression := forceExpression
|
||||||
|
if expressionFile != "" {
|
||||||
|
expressionBytes, err := os.ReadFile(expressionFile)
|
||||||
|
if err != nil {
|
||||||
|
return "", nil, err
|
||||||
|
}
|
||||||
|
expression = string(expressionBytes)
|
||||||
|
}
|
||||||
|
|
||||||
|
args := processStdInArgs(originalArgs)
|
||||||
|
yqlib.GetLogger().Debugf("processed args: %v", args)
|
||||||
|
if expression == "" && len(args) > 0 && args[0] != "-" && !maybeFile(args[0]) {
|
||||||
|
yqlib.GetLogger().Debug("assuming expression is '%v'", args[0])
|
||||||
|
expression = args[0]
|
||||||
|
args = args[1:]
|
||||||
|
}
|
||||||
|
return expression, args, nil
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -11,7 +11,7 @@ var (
|
|||||||
GitDescribe string
|
GitDescribe string
|
||||||
|
|
||||||
// Version is main version number that is being run at the moment.
|
// Version is main version number that is being run at the moment.
|
||||||
Version = "4.16.2"
|
Version = "v4.31.1"
|
||||||
|
|
||||||
// VersionPrerelease is a pre-release marker for the version. If this is "" (empty string)
|
// VersionPrerelease is a pre-release marker for the version. If this is "" (empty string)
|
||||||
// then it means that it is a final release. Otherwise, this is a pre-release
|
// then it means that it is a final release. Otherwise, this is a pre-release
|
||||||
|
|||||||
Vendored
+109
@@ -1,3 +1,112 @@
|
|||||||
|
yq (4.16.2) focal; urgency=medium
|
||||||
|
|
||||||
|
* Fixed with semicolon space issue
|
||||||
|
* Updating with documentation
|
||||||
|
* Added STDIN example to the top
|
||||||
|
* minor readme cleanup
|
||||||
|
* Help text tweak
|
||||||
|
* Fixed docker timeout - simplify docker builds
|
||||||
|
* New release with docker build fixes
|
||||||
|
* Updating to go 1.17 to fix CVE #944
|
||||||
|
* Fix a typo in root.go
|
||||||
|
* Skip the tests if the nocheck Debian build option is specified
|
||||||
|
* Fixed select bug (#958)
|
||||||
|
* Sped up explode operator
|
||||||
|
* Slight performance improvement to context.ChildContext
|
||||||
|
* Speed up multiply
|
||||||
|
* Update README with recently added / changed options
|
||||||
|
* Make deepMatch report in linear time
|
||||||
|
* Removed leadingContentPreProcessing flag - header preprocessing is stable
|
||||||
|
* Revert "Removed leadingContentPreProcessing flag - header preprocessing is stable"
|
||||||
|
* Keep flag, it is needed in corner cases
|
||||||
|
* Updated Readme
|
||||||
|
* Man page
|
||||||
|
* Fixed expression parsing bug #970
|
||||||
|
* Bumping go-lang, docker versions
|
||||||
|
* Added test release flow
|
||||||
|
* Updated github action release to generate man page
|
||||||
|
* Bumping version
|
||||||
|
* Removing no longer needed github action
|
||||||
|
* Added decoder op
|
||||||
|
* Fixed newline handling when decoding/encoding
|
||||||
|
* Fixed newline handling in encoder/decoder
|
||||||
|
* Can specify indent in encode ops
|
||||||
|
* Added group_by operator
|
||||||
|
* Added flatten operator
|
||||||
|
* Fixed flatten error message
|
||||||
|
* Improving docs
|
||||||
|
* Split printer
|
||||||
|
* Refactored command logic
|
||||||
|
* Fix JSON encoding removing null #985
|
||||||
|
* Fixed acceptance tests
|
||||||
|
* gitbook
|
||||||
|
* Update document generation script
|
||||||
|
* Updating README
|
||||||
|
* Updating release instructions
|
||||||
|
* github action no longer uses data1.yml
|
||||||
|
* Create dependabot.yml
|
||||||
|
* Bump actions/create-release from 1.0.0 to 1.1.4
|
||||||
|
* Bump actions/setup-go from 1 to 2.1.4
|
||||||
|
* Bump github.com/goccy/go-yaml from 1.8.9 to 1.9.4
|
||||||
|
* Bump github.com/jinzhu/copier from 0.2.8 to 0.3.2
|
||||||
|
* Bump github.com/fatih/color from 1.10.0 to 1.13.0
|
||||||
|
* Bump github.com/spf13/cobra from 1.1.3 to 1.2.1
|
||||||
|
* Update dependabot.yml
|
||||||
|
* Update go.yml
|
||||||
|
* add build check to PRs
|
||||||
|
* Include secure as part of build process
|
||||||
|
* Fixing bad label in github action
|
||||||
|
* fixed printer test
|
||||||
|
* remove leading content indicator
|
||||||
|
* Fixed header preprocessing!
|
||||||
|
* lint : define golangci configuration file
|
||||||
|
* Update check.sh
|
||||||
|
* Load file acceptance test
|
||||||
|
* Minor improvement on handling front matter
|
||||||
|
* Improved load doc
|
||||||
|
* feature: detect MANPATh and install there
|
||||||
|
* Update install-man-page.sh
|
||||||
|
* simplify prod stage, move version label to action
|
||||||
|
* add labels, quote some values
|
||||||
|
* enable errorlint linter
|
||||||
|
* Added errorlint to devtools
|
||||||
|
* Added key operator
|
||||||
|
* Added more tests
|
||||||
|
* Fixing comments
|
||||||
|
* Attempt to fix golint problem
|
||||||
|
* Include version query for tools
|
||||||
|
* Clean up errored file?
|
||||||
|
* enable misspell linter
|
||||||
|
* updated readme
|
||||||
|
* update Golangci version to v1.43.0
|
||||||
|
* gci linter
|
||||||
|
* Better merge array by key example
|
||||||
|
* Added credit for merge by array example
|
||||||
|
* Better formatting of merge arrays example
|
||||||
|
* Better merge example
|
||||||
|
* Add accessor for the yq logger instance (#1013)
|
||||||
|
* Fixed collect op when working with multiple nodes
|
||||||
|
* Added map, map_values
|
||||||
|
* Add support for Podman as well as Docker (#1026)
|
||||||
|
* Bump github.com/jinzhu/copier from 0.3.2 to 0.3.4 (#1027)
|
||||||
|
* Added csv, tsv output formats
|
||||||
|
* Added encoder tests
|
||||||
|
* Cleanup test
|
||||||
|
* Fixed docker permission issue #1014
|
||||||
|
* Recording release notes for next release
|
||||||
|
* Assignment op no longer clobbers anchor (#1029)
|
||||||
|
* Added sort_by operator
|
||||||
|
* Improved error message
|
||||||
|
* Improved tips and tricks
|
||||||
|
* Report while filename failed to parse #1030
|
||||||
|
* Added script for extracting checksums
|
||||||
|
* Improved extract-checksum.sh
|
||||||
|
* Bump github.com/spf13/cobra from 1.2.1 to 1.3.0 (#1039)
|
||||||
|
* enable more linters (#1043)
|
||||||
|
* Bump golang compiler #1037
|
||||||
|
|
||||||
|
-- Roberto Mier Escandon <rmescandon@gmail.com> Tue, 21 Dec 2021 09:41:44 +0000
|
||||||
|
|
||||||
yq (4.13.0) focal; urgency=medium
|
yq (4.13.0) focal; urgency=medium
|
||||||
|
|
||||||
* New `with` operator for making multiple changes to a given path
|
* New `with` operator for making multiple changes to a given path
|
||||||
|
|||||||
Vendored
+2
-1
@@ -3,7 +3,8 @@ Section: devel
|
|||||||
Priority: optional
|
Priority: optional
|
||||||
Maintainer: Roberto Mier Escandón <rmescandon@gmail.com>
|
Maintainer: Roberto Mier Escandón <rmescandon@gmail.com>
|
||||||
Build-Depends: debhelper (>=10),
|
Build-Depends: debhelper (>=10),
|
||||||
golang-1.15,
|
golang-1.17-go,
|
||||||
|
pandoc,
|
||||||
rsync
|
rsync
|
||||||
Standards-Version: 4.1.4
|
Standards-Version: 4.1.4
|
||||||
Homepage: https://github.com/mikefarah/yq.git
|
Homepage: https://github.com/mikefarah/yq.git
|
||||||
|
|||||||
Vendored
+19
-4
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/make -f
|
#!/usr/bin/make -f
|
||||||
#
|
#
|
||||||
# Copyright (C) 2018 Roberto Mier Escandón <rmescandon@gmail.com>
|
# Copyright (C) 2018-2021 Roberto Mier Escandón <rmescandon@gmail.com>
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License version 3 as
|
# it under the terms of the GNU General Public License version 3 as
|
||||||
@@ -17,20 +17,21 @@
|
|||||||
PROJECT := yq
|
PROJECT := yq
|
||||||
OWNER := mikefarah
|
OWNER := mikefarah
|
||||||
REPO := github.com
|
REPO := github.com
|
||||||
GOVERSION := 1.15
|
|
||||||
|
|
||||||
export DH_OPTIONS
|
export DH_OPTIONS
|
||||||
export DH_GOPKG := ${REPO}/${OWNER}/${PROJECT}
|
export DH_GOPKG := ${REPO}/${OWNER}/${PROJECT}
|
||||||
export GOROOT := /usr/lib/go-${GOVERSION}
|
export GOROOT := /usr/local/go
|
||||||
export GOPATH := ${CURDIR}/_build
|
export GOPATH := ${CURDIR}/_build
|
||||||
export GOBIN := ${GOPATH}/bin
|
export GOBIN := ${GOPATH}/bin
|
||||||
export PATH := ${GOROOT}/bin:${GOBIN}:${PATH}
|
export PATH := ${GOROOT}/bin:${GOBIN}:${PATH}
|
||||||
export GOCACHE := /tmp/gocache
|
export GOCACHE := /tmp/gocache
|
||||||
export GOFLAGS := -mod=vendor
|
export GOFLAGS := -mod=vendor
|
||||||
|
export GO111MODULE := on
|
||||||
|
|
||||||
SRCDIR := ${GOPATH}/src/${DH_GOPKG}
|
SRCDIR := ${GOPATH}/src/${DH_GOPKG}
|
||||||
DESTDIR := ${CURDIR}/debian/${PROJECT}
|
DESTDIR := ${CURDIR}/debian/${PROJECT}
|
||||||
BINDIR := /usr/bin
|
BINDIR := /usr/bin
|
||||||
|
MANDIR := /usr/share/man/man1/
|
||||||
ASSETSDIR := /usr/share/${PROJECT}
|
ASSETSDIR := /usr/share/${PROJECT}
|
||||||
|
|
||||||
%:
|
%:
|
||||||
@@ -42,7 +43,17 @@ override_dh_auto_build:
|
|||||||
# copy project to local srcdir to build from there
|
# copy project to local srcdir to build from there
|
||||||
rsync -avz --progress --exclude=_build --exclude=debian --exclude=tmp. --exclude=go.mod --exclude=docs . $(SRCDIR)
|
rsync -avz --progress --exclude=_build --exclude=debian --exclude=tmp. --exclude=go.mod --exclude=docs . $(SRCDIR)
|
||||||
# build go code
|
# build go code
|
||||||
(cd ${SRCDIR} && go install -buildmode=pie ./...)
|
( \
|
||||||
|
cd ${SRCDIR} && \
|
||||||
|
go install -buildmode=pie ./... \
|
||||||
|
)
|
||||||
|
|
||||||
|
# build man page
|
||||||
|
( \
|
||||||
|
cd ${SRCDIR} && \
|
||||||
|
./scripts/generate-man-page-md.sh && \
|
||||||
|
./scripts/generate-man-page.sh \
|
||||||
|
)
|
||||||
|
|
||||||
override_dh_auto_test:
|
override_dh_auto_test:
|
||||||
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
|
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
|
||||||
@@ -54,6 +65,10 @@ override_dh_auto_install:
|
|||||||
cp -f ${SRCDIR}/LICENSE ${DESTDIR}/${ASSETSDIR}
|
cp -f ${SRCDIR}/LICENSE ${DESTDIR}/${ASSETSDIR}
|
||||||
chmod a+x ${DESTDIR}/${BINDIR}/yq
|
chmod a+x ${DESTDIR}/${BINDIR}/yq
|
||||||
|
|
||||||
|
# man
|
||||||
|
mkdir -p "${DESTDIR}"/"${MANDIR}"
|
||||||
|
cp "${SRCDIR}"/yq.1 "${DESTDIR}"/"${MANDIR}" \
|
||||||
|
|
||||||
override_dh_auto_clean:
|
override_dh_auto_clean:
|
||||||
dh_clean
|
dh_clean
|
||||||
rm -rf ${CURDIR}/_build
|
rm -rf ${CURDIR}/_build
|
||||||
|
|||||||
+2
-11
@@ -1,11 +1,2 @@
|
|||||||
---
|
- [cat, dog, frog, cow]
|
||||||
- become: true
|
- [apple, banana, grape, mango]
|
||||||
gather_facts: false
|
|
||||||
hosts: lalaland
|
|
||||||
name: "Apply smth"
|
|
||||||
roles:
|
|
||||||
- lala
|
|
||||||
- land
|
|
||||||
serial: 1
|
|
||||||
- become: false
|
|
||||||
gather_facts: true
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
bXkgc2VjcmV0IGNoaWxsaSByZWNpcGUgaXMuLi4u
|
||||||
+1
-15
@@ -1,15 +1 @@
|
|||||||
strings:
|
["foobar", "foobaz", "blarp"]
|
||||||
- a: banana
|
|
||||||
- a: cat
|
|
||||||
- a: apple
|
|
||||||
|
|
||||||
numbers:
|
|
||||||
- a: 12
|
|
||||||
- a: 13
|
|
||||||
- a: 120
|
|
||||||
|
|
||||||
|
|
||||||
obj:
|
|
||||||
- a: {cat: "adog"}
|
|
||||||
- a: {cat: "doga"}
|
|
||||||
- a: apple
|
|
||||||
+5
-2
@@ -1,2 +1,5 @@
|
|||||||
c:
|
# --------------------------------------------------
|
||||||
d: hamster
|
# It's a test with comment
|
||||||
|
# --------------------------------------------------
|
||||||
|
groups:
|
||||||
|
- name: d
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
# comments on values appear
|
||||||
|
person.name = Mike
|
||||||
|
|
||||||
|
# comments on array values appear
|
||||||
|
person.pets.0 = cat
|
||||||
|
person.food.0 = pizza
|
||||||
+5
-2
@@ -1,2 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
date: "2022-11-25"
|
||||||
<cat legs="4">BiBi</cat>
|
raw:
|
||||||
|
id: 1
|
||||||
|
XML: text_outside_1<Tag1 />text_outside_2<Tag2Kling Klong</Tag2>text_outside_3
|
||||||
|
time: 09:19:00
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
name,numberOfCats,likesApples,height
|
||||||
|
,1,true,168.8
|
||||||
|
Samantha's Rabbit,2,false,-188.8
|
||||||
|
@@ -0,0 +1 @@
|
|||||||
|
this.is = a properties file
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
<this>is some xml</this>
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
# comment
|
||||||
|
# about things
|
||||||
|
a: cat
|
||||||
@@ -2,7 +2,8 @@ FROM mikefarah/yq:4
|
|||||||
|
|
||||||
COPY entrypoint.sh /entrypoint.sh
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
|
|
||||||
# this seems to be the default user in github actions
|
# github action recommendation is to run as root.
|
||||||
USER 1001
|
# https://docs.github.com/en/actions/creating-actions/dockerfile-support-for-github-actions#user
|
||||||
|
USER root
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
|||||||
@@ -2,8 +2,11 @@
|
|||||||
set -e
|
set -e
|
||||||
echo "::debug::\$cmd: $1"
|
echo "::debug::\$cmd: $1"
|
||||||
RESULT=$(eval "$1")
|
RESULT=$(eval "$1")
|
||||||
RESULT="${RESULT//'%'/'%25'}"
|
|
||||||
RESULT="${RESULT//$'\n'/'%0A'}"
|
|
||||||
RESULT="${RESULT//$'\r'/'%0D'}"
|
|
||||||
echo "::debug::\$RESULT: $RESULT"
|
echo "::debug::\$RESULT: $RESULT"
|
||||||
echo ::set-output name=result::"$RESULT"
|
# updating from
|
||||||
|
# https://github.com/orgs/community/discussions/26288#discussioncomment-3876281
|
||||||
|
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-output-parameter
|
||||||
|
delimiter=$(cat /proc/sys/kernel/random/uuid)
|
||||||
|
echo "result<<${delimiter}" >> "${GITHUB_OUTPUT}"
|
||||||
|
echo "${RESULT}" >> "${GITHUB_OUTPUT}"
|
||||||
|
echo "${delimiter}" >> "${GITHUB_OUTPUT}"
|
||||||
|
|||||||
@@ -1,27 +1,31 @@
|
|||||||
module github.com/mikefarah/yq/v4
|
module github.com/mikefarah/yq/v4
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/elliotchance/orderedmap v1.4.0
|
github.com/a8m/envsubst v1.4.1
|
||||||
github.com/fatih/color v1.13.0
|
github.com/alecthomas/participle/v2 v2.0.0-beta.5
|
||||||
github.com/goccy/go-yaml v1.9.4
|
github.com/alecthomas/repr v0.2.0
|
||||||
github.com/jinzhu/copier v0.3.4
|
github.com/dimchansky/utfbom v1.1.1
|
||||||
github.com/magiconair/properties v1.8.5
|
github.com/elliotchance/orderedmap v1.5.0
|
||||||
github.com/spf13/cobra v1.3.0
|
github.com/fatih/color v1.14.1
|
||||||
github.com/timtadh/lexmachine v0.2.2
|
github.com/goccy/go-json v0.10.0
|
||||||
golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d
|
github.com/goccy/go-yaml v1.9.8
|
||||||
|
github.com/jinzhu/copier v0.3.5
|
||||||
|
github.com/magiconair/properties v1.8.7
|
||||||
|
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e
|
||||||
|
github.com/spf13/cobra v1.6.1
|
||||||
|
github.com/spf13/pflag v1.0.5
|
||||||
|
golang.org/x/net v0.1.1-0.20221104162952-702349b0e862
|
||||||
gopkg.in/op/go-logging.v1 v1.0.0-20160211212156-b2cb9fa56473
|
gopkg.in/op/go-logging.v1 v1.0.0-20160211212156-b2cb9fa56473
|
||||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
|
gopkg.in/yaml.v3 v3.0.1
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/inconshreveable/mousetrap v1.0.0 // indirect
|
github.com/inconshreveable/mousetrap v1.0.1 // indirect
|
||||||
github.com/mattn/go-colorable v0.1.12 // indirect
|
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.14 // indirect
|
github.com/mattn/go-isatty v0.0.17 // indirect
|
||||||
github.com/spf13/pflag v1.0.5 // indirect
|
golang.org/x/sys v0.3.0 // indirect
|
||||||
github.com/timtadh/data-structures v0.5.3 // indirect
|
golang.org/x/text v0.4.0 // indirect
|
||||||
golang.org/x/sys v0.0.0-20211205182925-97ca703d548d // indirect
|
golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f // indirect
|
||||||
golang.org/x/text v0.3.7 // indirect
|
|
||||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
|
|
||||||
)
|
)
|
||||||
|
|
||||||
go 1.17
|
go 1.20
|
||||||
|
|||||||
@@ -1,792 +1,82 @@
|
|||||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
github.com/a8m/envsubst v1.4.1 h1:RShc2OKbQpIIp5qR2glVsBOJCImTVHFrDkJvmGh0Qi0=
|
||||||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
github.com/a8m/envsubst v1.4.1/go.mod h1:MVUTQNGQ3tsjOOtKCNd+fl8RzhsXcDvvAEzkhGtlsbY=
|
||||||
cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
|
github.com/alecthomas/assert/v2 v2.0.3 h1:WKqJODfOiQG0nEJKFKzDIG3E29CN2/4zR9XGJzKIkbg=
|
||||||
cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU=
|
github.com/alecthomas/participle/v2 v2.0.0-beta.5 h1:y6dsSYVb1G5eK6mgmy+BgI3Mw35a3WghArZ/Hbebrjo=
|
||||||
cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY=
|
github.com/alecthomas/participle/v2 v2.0.0-beta.5/go.mod h1:RC764t6n4L8D8ITAJv0qdokritYSNR3wV5cVwmIEaMM=
|
||||||
cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc=
|
github.com/alecthomas/repr v0.2.0 h1:HAzS41CIzNW5syS8Mf9UwXhNH1J9aix/BvDRf1Ml2Yk=
|
||||||
cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0=
|
github.com/alecthomas/repr v0.2.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4=
|
||||||
cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To=
|
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||||
cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4=
|
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
||||||
cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M=
|
|
||||||
cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc=
|
|
||||||
cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk=
|
|
||||||
cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs=
|
|
||||||
cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc=
|
|
||||||
cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY=
|
|
||||||
cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI=
|
|
||||||
cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk=
|
|
||||||
cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg=
|
|
||||||
cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8=
|
|
||||||
cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0=
|
|
||||||
cloud.google.com/go v0.83.0/go.mod h1:Z7MJUsANfY0pYPdw0lbnivPx4/vhy/e2FEkSkF7vAVY=
|
|
||||||
cloud.google.com/go v0.84.0/go.mod h1:RazrYuxIK6Kb7YrzzhPoLmCVzl7Sup4NrbKPg8KHSUM=
|
|
||||||
cloud.google.com/go v0.87.0/go.mod h1:TpDYlFy7vuLzZMMZ+B6iRiELaY7z/gJPaqbMx6mlWcY=
|
|
||||||
cloud.google.com/go v0.90.0/go.mod h1:kRX0mNRHe0e2rC6oNakvwQqzyDmg57xJ+SZU1eT2aDQ=
|
|
||||||
cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI=
|
|
||||||
cloud.google.com/go v0.94.1/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW4=
|
|
||||||
cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Udc=
|
|
||||||
cloud.google.com/go v0.98.0/go.mod h1:ua6Ush4NALrHk5QXDWnjvZHN93OuF0HfuEPq9I1X0cM=
|
|
||||||
cloud.google.com/go v0.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA=
|
|
||||||
cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=
|
|
||||||
cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE=
|
|
||||||
cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc=
|
|
||||||
cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg=
|
|
||||||
cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc=
|
|
||||||
cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ=
|
|
||||||
cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
|
|
||||||
cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk=
|
|
||||||
cloud.google.com/go/firestore v1.6.1/go.mod h1:asNXNOzBdyVQmEU+ggO8UPodTkEVFW5Qx+rwHnAz+EY=
|
|
||||||
cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=
|
|
||||||
cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw=
|
|
||||||
cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA=
|
|
||||||
cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU=
|
|
||||||
cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw=
|
|
||||||
cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos=
|
|
||||||
cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk=
|
|
||||||
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
|
|
||||||
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
|
|
||||||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
|
||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
|
||||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
|
||||||
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
|
|
||||||
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
|
|
||||||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
|
||||||
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
|
||||||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
|
||||||
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
|
||||||
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
|
|
||||||
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
|
|
||||||
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
|
|
||||||
github.com/armon/go-metrics v0.3.10/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc=
|
|
||||||
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
|
|
||||||
github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
|
|
||||||
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
|
||||||
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
|
|
||||||
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
|
||||||
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
|
|
||||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
|
||||||
github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
|
||||||
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
|
|
||||||
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
|
||||||
github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
|
||||||
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
|
|
||||||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
|
|
||||||
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
|
|
||||||
github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag=
|
|
||||||
github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I=
|
|
||||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
|
||||||
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
|
||||||
github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
|
|
||||||
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
|
|
||||||
github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI=
|
|
||||||
github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
|
|
||||||
github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
|
|
||||||
github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
|
|
||||||
github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
|
|
||||||
github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
|
|
||||||
github.com/cncf/xds/go v0.0.0-20211130200136-a8f946100490/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
|
|
||||||
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
|
|
||||||
github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
|
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/dimchansky/utfbom v1.1.1 h1:vV6w1AhK4VMnhBno/TPVCoK9U/LP0PkLCS9tbxHdi/U=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/dimchansky/utfbom v1.1.1/go.mod h1:SxdoEBH5qIqFocHMyGOXVAybYJdr71b1Q/j0mACtrfE=
|
||||||
github.com/elliotchance/orderedmap v1.4.0 h1:wZtfeEONCbx6in1CZyE6bELEt/vFayMvsxqI5SgsR+A=
|
github.com/elliotchance/orderedmap v1.5.0 h1:1IsExUsjv5XNBD3ZdC7jkAAqLWOOKdbPTmkHx63OsBg=
|
||||||
github.com/elliotchance/orderedmap v1.4.0/go.mod h1:wsDwEaX5jEoyhbs7x93zk2H/qv0zwuhg4inXhDkYqys=
|
github.com/elliotchance/orderedmap v1.5.0/go.mod h1:wsDwEaX5jEoyhbs7x93zk2H/qv0zwuhg4inXhDkYqys=
|
||||||
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
|
||||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
|
||||||
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
|
||||||
github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po=
|
|
||||||
github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
|
|
||||||
github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
|
|
||||||
github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ=
|
|
||||||
github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0=
|
|
||||||
github.com/envoyproxy/go-control-plane v0.10.1/go.mod h1:AY7fTTXNdv/aJ2O5jwpxAPOWUZ7hQAEvzN5Pf27BkQQ=
|
|
||||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
|
||||||
github.com/envoyproxy/protoc-gen-validate v0.6.2/go.mod h1:2t7qjJNvHPx8IjnBOzl9E9/baC+qXE/TeeyBRzgJDws=
|
|
||||||
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
|
||||||
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
|
|
||||||
github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
|
github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
|
||||||
github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
|
github.com/fatih/color v1.14.1 h1:qfhVLaG5s+nCROl1zJsZRxFeYrHLqWroPOQ8BWiNb4w=
|
||||||
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
|
github.com/fatih/color v1.14.1/go.mod h1:2oHN61fhTpgcxD3TSWCgKDiH1+x4OiDVVGH8WlgGZGg=
|
||||||
github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU=
|
|
||||||
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
|
||||||
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
|
|
||||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
|
||||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
|
||||||
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
|
||||||
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
|
||||||
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
|
|
||||||
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
|
|
||||||
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||||
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
|
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
|
||||||
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
|
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
|
||||||
github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4=
|
github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4=
|
||||||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
github.com/goccy/go-json v0.10.0 h1:mXKd9Qw4NuzShiRlOXKews24ufknHO7gx30lsDyokKA=
|
||||||
github.com/goccy/go-yaml v1.9.4 h1:S0GCYjwHKVI6IHqio7QWNKNThUl6NLzFd/g8Z65Axw8=
|
github.com/goccy/go-json v0.10.0/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
|
||||||
github.com/goccy/go-yaml v1.9.4/go.mod h1:U/jl18uSupI5rdI2jmuCswEA2htH9eXfferR3KfscvA=
|
github.com/goccy/go-yaml v1.9.8 h1:5gMyLUeU1/6zl+WFfR1hN7D2kf+1/eRGa7DFtToiBvQ=
|
||||||
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
github.com/goccy/go-yaml v1.9.8/go.mod h1:JubOolP3gh0HpiBc4BLRD4YmjEjHAmIIB2aaXKkTfoE=
|
||||||
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM=
|
||||||
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
|
github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc=
|
||||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
||||||
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
github.com/jinzhu/copier v0.3.5 h1:GlvfUwHk62RokgqVNvYsku0TATCF7bAHVwEXoBh3iJg=
|
||||||
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
github.com/jinzhu/copier v0.3.5/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg=
|
||||||
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
|
||||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
|
||||||
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
|
||||||
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
|
||||||
github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=
|
|
||||||
github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
|
|
||||||
github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
|
|
||||||
github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
|
|
||||||
github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=
|
|
||||||
github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8=
|
|
||||||
github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
|
|
||||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
|
||||||
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
|
||||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
|
||||||
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
|
||||||
github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
|
||||||
github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk=
|
|
||||||
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
|
|
||||||
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
|
|
||||||
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
|
|
||||||
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
|
|
||||||
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
|
|
||||||
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
|
|
||||||
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
|
||||||
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
|
||||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
|
||||||
github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM=
|
|
||||||
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
|
||||||
github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
|
||||||
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
|
||||||
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
|
||||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
|
||||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
|
||||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
|
||||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
|
||||||
github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
|
||||||
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
|
||||||
github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
|
||||||
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
|
||||||
github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
|
||||||
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
|
||||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
|
||||||
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
|
||||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
|
||||||
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
|
|
||||||
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
|
|
||||||
github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
|
|
||||||
github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk=
|
|
||||||
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
|
|
||||||
github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
|
|
||||||
github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
|
||||||
github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
|
||||||
github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
|
||||||
github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
|
||||||
github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
|
||||||
github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
|
||||||
github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
|
||||||
github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
|
||||||
github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
|
||||||
github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
|
||||||
github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
|
||||||
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
|
||||||
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
|
||||||
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
|
||||||
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
|
|
||||||
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
|
|
||||||
github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0=
|
|
||||||
github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM=
|
|
||||||
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
|
|
||||||
github.com/hashicorp/consul/api v1.11.0/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M=
|
|
||||||
github.com/hashicorp/consul/sdk v0.8.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms=
|
|
||||||
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
|
||||||
github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
|
|
||||||
github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
|
|
||||||
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
|
|
||||||
github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ=
|
|
||||||
github.com/hashicorp/go-hclog v1.0.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ=
|
|
||||||
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
|
|
||||||
github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
|
|
||||||
github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
|
|
||||||
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
|
|
||||||
github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA=
|
|
||||||
github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs=
|
|
||||||
github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8=
|
|
||||||
github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU=
|
|
||||||
github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=
|
|
||||||
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
|
||||||
github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
|
||||||
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
|
||||||
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
|
||||||
github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
|
|
||||||
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
|
||||||
github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
|
|
||||||
github.com/hashicorp/mdns v1.0.1/go.mod h1:4gW7WsVCke5TE7EPeYliwHlRUyBtfCwuFwuMg2DmyNY=
|
|
||||||
github.com/hashicorp/mdns v1.0.4/go.mod h1:mtBihi+LeNXGtG8L9dX59gAEa12BDtBQSp4v/YAJqrc=
|
|
||||||
github.com/hashicorp/memberlist v0.2.2/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE=
|
|
||||||
github.com/hashicorp/memberlist v0.3.0/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE=
|
|
||||||
github.com/hashicorp/serf v0.9.5/go.mod h1:UWDWwZeL5cuWDJdl0C6wrvrUwEqtQ4ZKBKKENpqIUyk=
|
|
||||||
github.com/hashicorp/serf v0.9.6/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4=
|
|
||||||
github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
|
|
||||||
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
|
||||||
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
|
||||||
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
|
|
||||||
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
|
||||||
github.com/jinzhu/copier v0.3.4 h1:mfU6jI9PtCeUjkjQ322dlff9ELjGDu975C2p/nrubVI=
|
|
||||||
github.com/jinzhu/copier v0.3.4/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg=
|
|
||||||
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
|
||||||
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
|
||||||
github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
|
||||||
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
|
||||||
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
|
|
||||||
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
|
|
||||||
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
|
||||||
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
|
|
||||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
|
||||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
|
||||||
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
|
|
||||||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
|
||||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
|
||||||
github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs=
|
|
||||||
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
|
||||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
|
||||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
|
||||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
|
||||||
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
|
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
|
||||||
github.com/lyft/protoc-gen-star v0.5.3/go.mod h1:V0xaHgaf5oCCqmcxYcWiDfTiKsZsRc87/1qhoTACD8w=
|
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
|
||||||
github.com/magiconair/properties v1.8.5 h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaWak/Gls=
|
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
|
||||||
github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60=
|
|
||||||
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
|
||||||
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
|
|
||||||
github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
|
|
||||||
github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
|
github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
|
||||||
github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
|
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
||||||
github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40=
|
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
||||||
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
|
|
||||||
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
|
|
||||||
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
|
||||||
github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84=
|
|
||||||
github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE=
|
|
||||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||||
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
|
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||||
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng=
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||||
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
|
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e h1:aoZm08cpOy4WuID//EZDgcC4zIxODThtZNPirFr42+A=
|
||||||
github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso=
|
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
|
||||||
github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI=
|
|
||||||
github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI=
|
|
||||||
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
|
||||||
github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI=
|
|
||||||
github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
|
||||||
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
|
||||||
github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
|
||||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
|
||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
|
||||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
|
||||||
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
|
||||||
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
|
||||||
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
|
||||||
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
|
||||||
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
|
||||||
github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
|
|
||||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
|
||||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
|
||||||
github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI=
|
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
|
|
||||||
github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s=
|
|
||||||
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
|
||||||
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
|
|
||||||
github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU=
|
|
||||||
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
|
||||||
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
|
||||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
|
||||||
github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
|
||||||
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
|
|
||||||
github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4=
|
|
||||||
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
|
||||||
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
|
|
||||||
github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
|
|
||||||
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
|
|
||||||
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
|
||||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||||
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA=
|
||||||
github.com/sagikazarmark/crypt v0.3.0/go.mod h1:uD/D+6UF4SrIR1uGEv7bBNkNqLGqUr43MRiaGWX1Nig=
|
github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY=
|
||||||
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
|
|
||||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
|
||||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
|
||||||
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
|
|
||||||
github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4=
|
|
||||||
github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I=
|
|
||||||
github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
|
||||||
github.com/spf13/cobra v1.3.0 h1:R7cSvGu+Vv+qX0gW5R/85dx2kmmJT5z5NM8ifdYjdn0=
|
|
||||||
github.com/spf13/cobra v1.3.0/go.mod h1:BrRVncBjOJa/eUcVVm9CE+oC6as8k+VYr4NY7WCi9V4=
|
|
||||||
github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo=
|
|
||||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||||
github.com/spf13/viper v1.10.0/go.mod h1:SoyBPwAtKDzypXNDFKN5kzH7ppppbGZtls1UpIy5AsM=
|
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
|
||||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
|
||||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
|
||||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
|
||||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
|
||||||
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
||||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
|
|
||||||
github.com/timtadh/data-structures v0.5.3 h1:F2tEjoG9qWIyUjbvXVgJqEOGJPMIiYn7U5W5mE+i/vQ=
|
|
||||||
github.com/timtadh/data-structures v0.5.3/go.mod h1:9R4XODhJ8JdWFEI8P/HJKqxuJctfBQw6fDibMQny2oU=
|
|
||||||
github.com/timtadh/lexmachine v0.2.2 h1:g55RnjdYazm5wnKv59pwFcBJHOyvTPfDEoz21s4PHmY=
|
|
||||||
github.com/timtadh/lexmachine v0.2.2/go.mod h1:GBJvD5OAfRn/gnp92zb9KTgHLB7akKyxmVivoYCcjQI=
|
|
||||||
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
|
|
||||||
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
|
||||||
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
|
||||||
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
|
||||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
|
||||||
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
|
||||||
go.etcd.io/etcd/api/v3 v3.5.1/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs=
|
|
||||||
go.etcd.io/etcd/client/pkg/v3 v3.5.1/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g=
|
|
||||||
go.etcd.io/etcd/client/v2 v2.305.1/go.mod h1:pMEacxZW7o8pg4CrFE7pquyCJJzZvkvdD2RibOCCCGs=
|
|
||||||
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
|
|
||||||
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
|
|
||||||
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
|
||||||
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
|
||||||
go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
|
||||||
go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=
|
|
||||||
go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E=
|
|
||||||
go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
|
|
||||||
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
|
|
||||||
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
|
|
||||||
go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo=
|
|
||||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
|
||||||
golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
|
||||||
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
|
||||||
golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
|
||||||
golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY=
|
|
||||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
|
||||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
|
||||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
|
||||||
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
|
||||||
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
|
|
||||||
golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek=
|
|
||||||
golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY=
|
|
||||||
golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
|
||||||
golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
|
||||||
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
|
||||||
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
|
|
||||||
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
|
|
||||||
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
|
|
||||||
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
|
||||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
|
||||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
|
||||||
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
|
||||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
|
||||||
golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
|
||||||
golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
|
||||||
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
|
||||||
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs=
|
|
||||||
golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
|
||||||
golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
|
||||||
golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
|
||||||
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
|
||||||
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
|
|
||||||
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
|
|
||||||
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
|
|
||||||
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
|
|
||||||
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
|
||||||
golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
|
||||||
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
|
||||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
|
||||||
golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
|
||||||
golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
|
||||||
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
|
||||||
golang.org/x/mod v0.5.0/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
|
|
||||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
|
||||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
|
||||||
golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
|
||||||
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
|
||||||
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
|
||||||
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
|
||||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
|
||||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
golang.org/x/net v0.1.1-0.20221104162952-702349b0e862 h1:KrLJ+iz8J6j6VVr/OCfULAcK+xozUmWE43fKpMR4MlI=
|
||||||
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
golang.org/x/net v0.1.1-0.20221104162952-702349b0e862/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
|
||||||
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
|
|
||||||
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
|
||||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
|
||||||
golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
|
||||||
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
|
||||||
golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
|
||||||
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
|
||||||
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
|
||||||
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
|
||||||
golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
|
||||||
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
|
||||||
golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
|
||||||
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
|
||||||
golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
|
||||||
golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
|
||||||
golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
|
||||||
golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
|
||||||
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
|
||||||
golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
|
||||||
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
|
||||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
|
||||||
golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
|
||||||
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
|
||||||
golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
|
||||||
golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
|
||||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
|
||||||
golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc=
|
|
||||||
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
|
|
||||||
golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy7fQ90B1CfIiPueXVOjqfkSzI8=
|
|
||||||
golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
|
||||||
golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d h1:LO7XpTYMwTqxjLcGWPijK3vRXg1aWdlNOVOHRq45d7c=
|
|
||||||
golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
|
||||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
|
||||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
|
||||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
|
||||||
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
|
||||||
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
|
||||||
golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
|
||||||
golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
|
||||||
golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
|
||||||
golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
|
||||||
golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
|
||||||
golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
|
||||||
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
|
||||||
golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
|
||||||
golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
|
||||||
golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
|
||||||
golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
|
||||||
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
|
||||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
|
||||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
|
||||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
|
||||||
golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
|
||||||
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
|
||||||
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20220406163625-3f8b81556e12/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ=
|
||||||
golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.0.0-20211205182925-97ca703d548d h1:FjkYO/PPp4Wi0EAUOVLxePm7qVW4r4ctbWpURyuOD0E=
|
|
||||||
golang.org/x/sys v0.0.0-20211205182925-97ca703d548d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
|
||||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
|
||||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg=
|
||||||
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||||
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
|
||||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
|
||||||
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
|
|
||||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
|
||||||
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
|
||||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
|
||||||
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
|
||||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
|
||||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
|
||||||
golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
|
||||||
golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
|
||||||
golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
|
||||||
golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
|
||||||
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
|
||||||
golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
|
||||||
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
|
||||||
golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
|
||||||
golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
|
||||||
golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
|
||||||
golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
|
||||||
golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
|
||||||
golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
|
||||||
golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
|
||||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
|
||||||
golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
|
||||||
golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
|
||||||
golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
|
||||||
golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
|
||||||
golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
|
||||||
golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
|
||||||
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
|
||||||
golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
|
||||||
golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
|
||||||
golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
|
||||||
golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
|
||||||
golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
|
||||||
golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=
|
|
||||||
golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=
|
|
||||||
golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8=
|
|
||||||
golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
|
||||||
golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
|
||||||
golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
|
||||||
golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
|
||||||
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
|
||||||
golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
|
||||||
golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
|
||||||
golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
|
||||||
golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE=
|
|
||||||
golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
|
||||||
golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
|
||||||
golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
|
||||||
golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
|
||||||
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
|
||||||
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
|
|
||||||
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
|
||||||
golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
|
||||||
golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
|
||||||
golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
|
||||||
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
|
||||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
|
||||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
|
||||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
|
||||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
|
|
||||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
|
golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f h1:uF6paiQQebLeSXkrTqHqz0MXhXXS1KgF41eUdBNvxK0=
|
||||||
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
|
golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8=
|
||||||
google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||||
google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
|
|
||||||
google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
|
|
||||||
google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
|
|
||||||
google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
|
|
||||||
google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
|
||||||
google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
|
||||||
google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
|
||||||
google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
|
||||||
google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
|
||||||
google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE=
|
|
||||||
google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE=
|
|
||||||
google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM=
|
|
||||||
google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc=
|
|
||||||
google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg=
|
|
||||||
google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE=
|
|
||||||
google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8=
|
|
||||||
google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU=
|
|
||||||
google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94=
|
|
||||||
google.golang.org/api v0.47.0/go.mod h1:Wbvgpq1HddcWVtzsVLyfLp8lDg6AA241LmgIL59tHXo=
|
|
||||||
google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtukyy4=
|
|
||||||
google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw=
|
|
||||||
google.golang.org/api v0.51.0/go.mod h1:t4HdrdoNgyN5cbEfm7Lum0lcLDLiise1F8qDKX00sOU=
|
|
||||||
google.golang.org/api v0.54.0/go.mod h1:7C4bFFOvVDGXjfDTAsgGwDgAxRDeQ4X8NvUedIt6z3k=
|
|
||||||
google.golang.org/api v0.55.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE=
|
|
||||||
google.golang.org/api v0.56.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE=
|
|
||||||
google.golang.org/api v0.57.0/go.mod h1:dVPlbZyBo2/OjBpmvNdpn2GRm6rPy75jyU7bmhdrMgI=
|
|
||||||
google.golang.org/api v0.59.0/go.mod h1:sT2boj7M9YJxZzgeZqXogmhfmRWDtPzT31xkieUbuZU=
|
|
||||||
google.golang.org/api v0.61.0/go.mod h1:xQRti5UdCmoCEqFxcz93fTl338AVqDgyaDRuOZ3hg9I=
|
|
||||||
google.golang.org/api v0.62.0/go.mod h1:dKmwPCydfsad4qCH08MSdgWjfHOyfpd4VtDGgRFdavw=
|
|
||||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
|
||||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
|
||||||
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
|
||||||
google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=
|
|
||||||
google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
|
||||||
google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
|
||||||
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
|
||||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
|
||||||
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
|
||||||
google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
|
||||||
google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
|
||||||
google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
|
||||||
google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
|
||||||
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
|
||||||
google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8=
|
|
||||||
google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
|
||||||
google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
|
||||||
google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
|
||||||
google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
|
||||||
google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
|
||||||
google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
|
||||||
google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA=
|
|
||||||
google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
|
||||||
google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
|
||||||
google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
|
||||||
google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
|
||||||
google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
|
||||||
google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
|
||||||
google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
|
||||||
google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
|
||||||
google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
|
||||||
google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U=
|
|
||||||
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
|
|
||||||
google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA=
|
|
||||||
google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
|
||||||
google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
|
||||||
google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
|
||||||
google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
|
||||||
google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
|
||||||
google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
|
||||||
google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
|
||||||
google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
|
||||||
google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
|
||||||
google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
|
||||||
google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
|
||||||
google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
|
||||||
google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A=
|
|
||||||
google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A=
|
|
||||||
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0=
|
|
||||||
google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0=
|
|
||||||
google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0=
|
|
||||||
google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24=
|
|
||||||
google.golang.org/genproto v0.0.0-20210713002101-d411969a0d9a/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k=
|
|
||||||
google.golang.org/genproto v0.0.0-20210716133855-ce7ef5c701ea/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k=
|
|
||||||
google.golang.org/genproto v0.0.0-20210728212813-7823e685a01f/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48=
|
|
||||||
google.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48=
|
|
||||||
google.golang.org/genproto v0.0.0-20210813162853-db860fec028c/go.mod h1:cFeNkxwySK631ADgubI+/XFU/xp8FD5KIVV4rj8UC5w=
|
|
||||||
google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=
|
|
||||||
google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=
|
|
||||||
google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=
|
|
||||||
google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=
|
|
||||||
google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=
|
|
||||||
google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
|
||||||
google.golang.org/genproto v0.0.0-20211008145708-270636b82663/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
|
||||||
google.golang.org/genproto v0.0.0-20211028162531-8db9c33dc351/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
|
||||||
google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
|
||||||
google.golang.org/genproto v0.0.0-20211129164237-f09f9a12af12/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
|
||||||
google.golang.org/genproto v0.0.0-20211203200212-54befc351ae9/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
|
||||||
google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
|
||||||
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
|
||||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
|
||||||
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
|
|
||||||
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
|
|
||||||
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
|
||||||
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
|
|
||||||
google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
|
||||||
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
|
||||||
google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
|
||||||
google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60=
|
|
||||||
google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=
|
|
||||||
google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
|
||||||
google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
|
||||||
google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
|
||||||
google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0=
|
|
||||||
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
|
|
||||||
google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8=
|
|
||||||
google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
|
|
||||||
google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
|
|
||||||
google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
|
|
||||||
google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
|
|
||||||
google.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
|
|
||||||
google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
|
|
||||||
google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE=
|
|
||||||
google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE=
|
|
||||||
google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
|
|
||||||
google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
|
|
||||||
google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
|
|
||||||
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
|
|
||||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
|
||||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
|
||||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
|
||||||
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
|
|
||||||
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
|
||||||
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
|
||||||
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
|
||||||
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
|
||||||
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
|
|
||||||
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
|
|
||||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
|
||||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
|
||||||
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
|
||||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
|
||||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
|
|
||||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
|
||||||
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
|
||||||
gopkg.in/ini.v1 v1.66.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
|
||||||
gopkg.in/op/go-logging.v1 v1.0.0-20160211212156-b2cb9fa56473 h1:6D+BvnJ/j6e222UW8s2qTSe3wGBtvo0MbVQG/c5k8RE=
|
gopkg.in/op/go-logging.v1 v1.0.0-20160211212156-b2cb9fa56473 h1:6D+BvnJ/j6e222UW8s2qTSe3wGBtvo0MbVQG/c5k8RE=
|
||||||
gopkg.in/op/go-logging.v1 v1.0.0-20160211212156-b2cb9fa56473/go.mod h1:N1eN2tsCx0Ydtgjl4cqmbRCsY4/+z4cYDeqwZTk6zog=
|
gopkg.in/op/go-logging.v1 v1.0.0-20160211212156-b2cb9fa56473/go.mod h1:N1eN2tsCx0Ydtgjl4cqmbRCsY4/+z4cYDeqwZTk6zog=
|
||||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
|
||||||
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
|
||||||
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
|
||||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
|
||||||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
|
||||||
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
|
||||||
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
|
||||||
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
|
|
||||||
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
|
|
||||||
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
|
|
||||||
|
|||||||
+4
-4
@@ -19,7 +19,7 @@ with an expression:
|
|||||||
.a = .b
|
.a = .b
|
||||||
```
|
```
|
||||||
|
|
||||||
Like math expression - operator precedence is important.
|
Like math expressions - operator precedence is important.
|
||||||
|
|
||||||
The `=` operator takes two arguments, a `lhs` expression, which in this case is `.a` and `rhs` expression which is `.b`.
|
The `=` operator takes two arguments, a `lhs` expression, which in this case is `.a` and `rhs` expression which is `.b`.
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ The `=` operator then pipes the 'root' context through the `rhs` expression of `
|
|||||||
dog
|
dog
|
||||||
```
|
```
|
||||||
|
|
||||||
Both sides have now been evaluated, so now the operator copies across the value from the RHS (`.b`) to the the LHS (`.a`), and it returns the now updated context:
|
Both sides have now been evaluated, so now the operator copies across the value from the RHS (`.b`) to the LHS (`.a`), and it returns the now updated context:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
a: dog
|
a: dog
|
||||||
@@ -47,7 +47,7 @@ b: dog
|
|||||||
|
|
||||||
## Complex assignment, operator precedence rules
|
## Complex assignment, operator precedence rules
|
||||||
|
|
||||||
Just like math expression - `yq` expression have an order of precedence. The pipe `|` operator has a low order of precedence, so operators with higher precedence will get evalated first.
|
Just like math expressions - `yq` expressions have an order of precedence. The pipe `|` operator has a low order of precedence, so operators with higher precedence will get evaluated first.
|
||||||
|
|
||||||
Most of the time, this is intuitively what you'd want, for instance `.a = "cat" | .b = "dog"` is effectively: `(.a = "cat") | (.b = "dog")`.
|
Most of the time, this is intuitively what you'd want, for instance `.a = "cat" | .b = "dog"` is effectively: `(.a = "cat") | (.b = "dog")`.
|
||||||
|
|
||||||
@@ -66,7 +66,7 @@ Lets say you had:
|
|||||||
Lets say you wanted to update the `sally` entry to have fruit: 'mango'. The _incorrect_ way to do that is:
|
Lets say you wanted to update the `sally` entry to have fruit: 'mango'. The _incorrect_ way to do that is:
|
||||||
`.[] | select(.name == "sally") | .fruit = "mango"`.
|
`.[] | select(.name == "sally") | .fruit = "mango"`.
|
||||||
|
|
||||||
Becasue `|` has a low operator precedence, this will be evaluated (_incorrectly_) as : `(.[]) | (select(.name == "sally")) | (.fruit = "mango")`. What you'll see is only the updated segment returned:
|
Because `|` has a low operator precedence, this will be evaluated (_incorrectly_) as : `(.[]) | (select(.name == "sally")) | (.fruit = "mango")`. What you'll see is only the updated segment returned:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
name: sally
|
name: sally
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# ./yq ea '.[]' examples/data*.yaml
|
|
||||||
|
|
||||||
|
|
||||||
./yq ea '
|
|
||||||
((.[] | {.name: .}) as $item ireduce ({}; . * $item )) as $uniqueMap
|
|
||||||
| ( $uniqueMap | to_entries | .[]) as $item ireduce([]; . + $item.value)
|
|
||||||
' examples/data*.yaml
|
|
||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
|
|
||||||
// A yaml expression evaluator that runs the expression once against all files/nodes in memory.
|
// A yaml expression evaluator that runs the expression once against all files/nodes in memory.
|
||||||
type Evaluator interface {
|
type Evaluator interface {
|
||||||
EvaluateFiles(expression string, filenames []string, printer Printer, leadingContentPreProcessing bool, decoder Decoder) error
|
EvaluateFiles(expression string, filenames []string, printer Printer, decoder Decoder) error
|
||||||
|
|
||||||
// EvaluateNodes takes an expression and one or more yaml nodes, returning a list of matching candidate nodes
|
// EvaluateNodes takes an expression and one or more yaml nodes, returning a list of matching candidate nodes
|
||||||
EvaluateNodes(expression string, nodes ...*yaml.Node) (*list.List, error)
|
EvaluateNodes(expression string, nodes ...*yaml.Node) (*list.List, error)
|
||||||
@@ -19,11 +19,11 @@ type Evaluator interface {
|
|||||||
|
|
||||||
type allAtOnceEvaluator struct {
|
type allAtOnceEvaluator struct {
|
||||||
treeNavigator DataTreeNavigator
|
treeNavigator DataTreeNavigator
|
||||||
treeCreator ExpressionParser
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewAllAtOnceEvaluator() Evaluator {
|
func NewAllAtOnceEvaluator() Evaluator {
|
||||||
return &allAtOnceEvaluator{treeNavigator: NewDataTreeNavigator(), treeCreator: NewExpressionParser()}
|
InitExpressionParser()
|
||||||
|
return &allAtOnceEvaluator{treeNavigator: NewDataTreeNavigator()}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *allAtOnceEvaluator) EvaluateNodes(expression string, nodes ...*yaml.Node) (*list.List, error) {
|
func (e *allAtOnceEvaluator) EvaluateNodes(expression string, nodes ...*yaml.Node) (*list.List, error) {
|
||||||
@@ -35,7 +35,7 @@ func (e *allAtOnceEvaluator) EvaluateNodes(expression string, nodes ...*yaml.Nod
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (e *allAtOnceEvaluator) EvaluateCandidateNodes(expression string, inputCandidates *list.List) (*list.List, error) {
|
func (e *allAtOnceEvaluator) EvaluateCandidateNodes(expression string, inputCandidates *list.List) (*list.List, error) {
|
||||||
node, err := e.treeCreator.ParseExpression(expression)
|
node, err := ExpressionParser.ParseExpression(expression)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -46,21 +46,16 @@ func (e *allAtOnceEvaluator) EvaluateCandidateNodes(expression string, inputCand
|
|||||||
return context.MatchingNodes, nil
|
return context.MatchingNodes, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *allAtOnceEvaluator) EvaluateFiles(expression string, filenames []string, printer Printer, leadingContentPreProcessing bool, decoder Decoder) error {
|
func (e *allAtOnceEvaluator) EvaluateFiles(expression string, filenames []string, printer Printer, decoder Decoder) error {
|
||||||
fileIndex := 0
|
fileIndex := 0
|
||||||
firstFileLeadingContent := ""
|
|
||||||
|
|
||||||
var allDocuments = list.New()
|
var allDocuments = list.New()
|
||||||
for _, filename := range filenames {
|
for _, filename := range filenames {
|
||||||
reader, leadingContent, err := readStream(filename, fileIndex == 0 && leadingContentPreProcessing)
|
reader, err := readStream(filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if fileIndex == 0 {
|
|
||||||
firstFileLeadingContent = leadingContent
|
|
||||||
}
|
|
||||||
|
|
||||||
fileDocuments, err := readDocuments(reader, filename, fileIndex, decoder)
|
fileDocuments, err := readDocuments(reader, filename, fileIndex, decoder)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -75,11 +70,9 @@ func (e *allAtOnceEvaluator) EvaluateFiles(expression string, filenames []string
|
|||||||
Filename: "",
|
Filename: "",
|
||||||
Node: &yaml.Node{Kind: yaml.DocumentNode, Content: []*yaml.Node{{Tag: "!!null", Kind: yaml.ScalarNode}}},
|
Node: &yaml.Node{Kind: yaml.DocumentNode, Content: []*yaml.Node{{Tag: "!!null", Kind: yaml.ScalarNode}}},
|
||||||
FileIndex: 0,
|
FileIndex: 0,
|
||||||
LeadingContent: firstFileLeadingContent,
|
LeadingContent: "",
|
||||||
}
|
}
|
||||||
allDocuments.PushBack(candidateNode)
|
allDocuments.PushBack(candidateNode)
|
||||||
} else {
|
|
||||||
allDocuments.Front().Value.(*CandidateNode).LeadingContent = firstFileLeadingContent
|
|
||||||
}
|
}
|
||||||
|
|
||||||
matches, err := e.EvaluateCandidateNodes(expression, allDocuments)
|
matches, err := e.EvaluateCandidateNodes(expression, allDocuments)
|
||||||
|
|||||||
@@ -14,14 +14,15 @@ type CandidateNode struct {
|
|||||||
Parent *CandidateNode // parent node
|
Parent *CandidateNode // parent node
|
||||||
Key *yaml.Node // node key, if this is a value from a map (or index in an array)
|
Key *yaml.Node // node key, if this is a value from a map (or index in an array)
|
||||||
|
|
||||||
LeadingContent string
|
LeadingContent string
|
||||||
|
TrailingContent string
|
||||||
|
|
||||||
Path []interface{} /// the path we took to get to this node
|
Path []interface{} /// the path we took to get to this node
|
||||||
Document uint // the document index of this node
|
Document uint // the document index of this node
|
||||||
Filename string
|
Filename string
|
||||||
FileIndex int
|
FileIndex int
|
||||||
// when performing op against all nodes given, this will treat all the nodes as one
|
// when performing op against all nodes given, this will treat all the nodes as one
|
||||||
// (e.g. top level cross document merge). This property does not propegate to child nodes.
|
// (e.g. top level cross document merge). This property does not propagate to child nodes.
|
||||||
EvaluateTogether bool
|
EvaluateTogether bool
|
||||||
IsMapKey bool
|
IsMapKey bool
|
||||||
}
|
}
|
||||||
@@ -96,6 +97,13 @@ func (n *CandidateNode) CreateReplacement(node *yaml.Node) *CandidateNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (n *CandidateNode) CreateReplacementWithDocWrappers(node *yaml.Node) *CandidateNode {
|
||||||
|
replacement := n.CreateReplacement(node)
|
||||||
|
replacement.LeadingContent = n.LeadingContent
|
||||||
|
replacement.TrailingContent = n.TrailingContent
|
||||||
|
return replacement
|
||||||
|
}
|
||||||
|
|
||||||
func (n *CandidateNode) createChildPath(path interface{}) []interface{} {
|
func (n *CandidateNode) createChildPath(path interface{}) []interface{} {
|
||||||
if path == nil {
|
if path == nil {
|
||||||
newPath := make([]interface{}, len(n.Path))
|
newPath := make([]interface{}, len(n.Path))
|
||||||
@@ -116,15 +124,26 @@ func (n *CandidateNode) Copy() (*CandidateNode, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
clone.Node = deepClone(n.Node)
|
||||||
return clone, nil
|
return clone, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// updates this candidate from the given candidate node
|
// updates this candidate from the given candidate node
|
||||||
func (n *CandidateNode) UpdateFrom(other *CandidateNode, prefs assignPreferences) {
|
func (n *CandidateNode) UpdateFrom(other *CandidateNode, prefs assignPreferences) {
|
||||||
|
|
||||||
n.UpdateAttributesFrom(other, prefs)
|
// if this is an empty map or empty array, use the style of other node.
|
||||||
n.Node.Content = other.Node.Content
|
if (n.Node.Kind != yaml.ScalarNode && len(n.Node.Content) == 0) ||
|
||||||
|
// if the tag has changed (e.g. from str to bool)
|
||||||
|
(guessTagFromCustomType(n.Node) != guessTagFromCustomType(other.Node)) {
|
||||||
|
n.Node.Style = other.Node.Style
|
||||||
|
}
|
||||||
|
|
||||||
|
n.Node.Content = deepCloneContent(other.Node.Content)
|
||||||
|
n.Node.Kind = other.Node.Kind
|
||||||
n.Node.Value = other.Node.Value
|
n.Node.Value = other.Node.Value
|
||||||
|
|
||||||
|
n.UpdateAttributesFrom(other, prefs)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *CandidateNode) UpdateAttributesFrom(other *CandidateNode, prefs assignPreferences) {
|
func (n *CandidateNode) UpdateAttributesFrom(other *CandidateNode, prefs assignPreferences) {
|
||||||
@@ -136,7 +155,12 @@ func (n *CandidateNode) UpdateAttributesFrom(other *CandidateNode, prefs assignP
|
|||||||
n.Node.Value = ""
|
n.Node.Value = ""
|
||||||
}
|
}
|
||||||
n.Node.Kind = other.Node.Kind
|
n.Node.Kind = other.Node.Kind
|
||||||
n.Node.Tag = other.Node.Tag
|
|
||||||
|
// don't clobber custom tags...
|
||||||
|
if prefs.ClobberCustomTags || strings.HasPrefix(n.Node.Tag, "!!") || n.Node.Tag == "" {
|
||||||
|
n.Node.Tag = other.Node.Tag
|
||||||
|
}
|
||||||
|
|
||||||
n.Node.Alias = other.Node.Alias
|
n.Node.Alias = other.Node.Alias
|
||||||
|
|
||||||
if !prefs.DontOverWriteAnchor {
|
if !prefs.DontOverWriteAnchor {
|
||||||
@@ -145,6 +169,7 @@ func (n *CandidateNode) UpdateAttributesFrom(other *CandidateNode, prefs assignP
|
|||||||
|
|
||||||
// merge will pickup the style of the new thing
|
// merge will pickup the style of the new thing
|
||||||
// when autocreating nodes
|
// when autocreating nodes
|
||||||
|
|
||||||
if n.Node.Style == 0 {
|
if n.Node.Style == 0 {
|
||||||
n.Node.Style = other.Node.Style
|
n.Node.Style = other.Node.Style
|
||||||
}
|
}
|
||||||
@@ -152,6 +177,9 @@ func (n *CandidateNode) UpdateAttributesFrom(other *CandidateNode, prefs assignP
|
|||||||
if other.Node.FootComment != "" {
|
if other.Node.FootComment != "" {
|
||||||
n.Node.FootComment = other.Node.FootComment
|
n.Node.FootComment = other.Node.FootComment
|
||||||
}
|
}
|
||||||
|
if other.TrailingContent != "" {
|
||||||
|
n.TrailingContent = other.TrailingContent
|
||||||
|
}
|
||||||
if other.Node.HeadComment != "" {
|
if other.Node.HeadComment != "" {
|
||||||
n.Node.HeadComment = other.Node.HeadComment
|
n.Node.HeadComment = other.Node.HeadComment
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
//go:build linux
|
||||||
|
|
||||||
|
package yqlib
|
||||||
|
|
||||||
|
import (
|
||||||
|
"io/fs"
|
||||||
|
"os"
|
||||||
|
"syscall"
|
||||||
|
)
|
||||||
|
|
||||||
|
func changeOwner(info fs.FileInfo, file *os.File) error {
|
||||||
|
if stat, ok := info.Sys().(*syscall.Stat_t); ok {
|
||||||
|
uid := int(stat.Uid)
|
||||||
|
gid := int(stat.Gid)
|
||||||
|
|
||||||
|
err := os.Chown(file.Name(), uid, gid)
|
||||||
|
if err != nil {
|
||||||
|
// this happens with snap confinement
|
||||||
|
// not really a big issue as users can chown
|
||||||
|
// the file themselves if required.
|
||||||
|
log.Info("Skipping chown: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
//go:build !linux
|
||||||
|
|
||||||
|
package yqlib
|
||||||
|
|
||||||
|
import (
|
||||||
|
"io/fs"
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
func changeOwner(info fs.FileInfo, file *os.File) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
+14
-1
@@ -3,6 +3,7 @@ package yqlib
|
|||||||
import (
|
import (
|
||||||
"container/list"
|
"container/list"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/jinzhu/copier"
|
"github.com/jinzhu/copier"
|
||||||
logging "gopkg.in/op/go-logging.v1"
|
logging "gopkg.in/op/go-logging.v1"
|
||||||
@@ -12,6 +13,7 @@ type Context struct {
|
|||||||
MatchingNodes *list.List
|
MatchingNodes *list.List
|
||||||
Variables map[string]*list.List
|
Variables map[string]*list.List
|
||||||
DontAutoCreate bool
|
DontAutoCreate bool
|
||||||
|
datetimeLayout string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Context) SingleReadonlyChildContext(candidate *CandidateNode) Context {
|
func (n *Context) SingleReadonlyChildContext(candidate *CandidateNode) Context {
|
||||||
@@ -28,6 +30,17 @@ func (n *Context) SingleChildContext(candidate *CandidateNode) Context {
|
|||||||
return n.ChildContext(list)
|
return n.ChildContext(list)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (n *Context) SetDateTimeLayout(newDateTimeLayout string) {
|
||||||
|
n.datetimeLayout = newDateTimeLayout
|
||||||
|
}
|
||||||
|
|
||||||
|
func (n *Context) GetDateTimeLayout() string {
|
||||||
|
if n.datetimeLayout != "" {
|
||||||
|
return n.datetimeLayout
|
||||||
|
}
|
||||||
|
return time.RFC3339
|
||||||
|
}
|
||||||
|
|
||||||
func (n *Context) GetVariable(name string) *list.List {
|
func (n *Context) GetVariable(name string) *list.List {
|
||||||
if n.Variables == nil {
|
if n.Variables == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -43,7 +56,7 @@ func (n *Context) SetVariable(name string, value *list.List) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (n *Context) ChildContext(results *list.List) Context {
|
func (n *Context) ChildContext(results *list.List) Context {
|
||||||
clone := Context{DontAutoCreate: n.DontAutoCreate}
|
clone := Context{DontAutoCreate: n.DontAutoCreate, datetimeLayout: n.datetimeLayout}
|
||||||
clone.Variables = make(map[string]*list.List)
|
clone.Variables = make(map[string]*list.List)
|
||||||
if len(n.Variables) > 0 {
|
if len(n.Variables) > 0 {
|
||||||
err := copier.Copy(&clone.Variables, n.Variables)
|
err := copier.Copy(&clone.Variables, n.Variables)
|
||||||
|
|||||||
@@ -0,0 +1,282 @@
|
|||||||
|
package yqlib
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bufio"
|
||||||
|
"fmt"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/mikefarah/yq/v4/test"
|
||||||
|
)
|
||||||
|
|
||||||
|
const csvSimple = `name,numberOfCats,likesApples,height
|
||||||
|
Gary,1,true,168.8
|
||||||
|
Samantha's Rabbit,2,false,-188.8
|
||||||
|
`
|
||||||
|
const csvMissing = `name,numberOfCats,likesApples,height
|
||||||
|
,null,,168.8
|
||||||
|
`
|
||||||
|
const expectedUpdatedSimpleCsv = `name,numberOfCats,likesApples,height
|
||||||
|
Gary,3,true,168.8
|
||||||
|
Samantha's Rabbit,2,false,-188.8
|
||||||
|
`
|
||||||
|
|
||||||
|
const csvSimpleShort = `Name,Number of Cats
|
||||||
|
Gary,1
|
||||||
|
Samantha's Rabbit,2
|
||||||
|
`
|
||||||
|
|
||||||
|
const tsvSimple = `name numberOfCats likesApples height
|
||||||
|
Gary 1 true 168.8
|
||||||
|
Samantha's Rabbit 2 false -188.8
|
||||||
|
`
|
||||||
|
|
||||||
|
const expectedYamlFromCSV = `- name: Gary
|
||||||
|
numberOfCats: 1
|
||||||
|
likesApples: true
|
||||||
|
height: 168.8
|
||||||
|
- name: Samantha's Rabbit
|
||||||
|
numberOfCats: 2
|
||||||
|
likesApples: false
|
||||||
|
height: -188.8
|
||||||
|
`
|
||||||
|
|
||||||
|
const expectedYamlFromCSVMissingData = `- name: Gary
|
||||||
|
numberOfCats: 1
|
||||||
|
height: 168.8
|
||||||
|
- name: Samantha's Rabbit
|
||||||
|
height: -188.8
|
||||||
|
likesApples: false
|
||||||
|
`
|
||||||
|
|
||||||
|
const csvSimpleMissingData = `name,numberOfCats,height
|
||||||
|
Gary,1,168.8
|
||||||
|
Samantha's Rabbit,,-188.8
|
||||||
|
`
|
||||||
|
|
||||||
|
const csvTestSimpleYaml = `- [i, like, csv]
|
||||||
|
- [because, excel, is, cool]`
|
||||||
|
|
||||||
|
const expectedSimpleCsv = `i,like,csv
|
||||||
|
because,excel,is,cool
|
||||||
|
`
|
||||||
|
|
||||||
|
const tsvTestExpectedSimpleCsv = `i like csv
|
||||||
|
because excel is cool
|
||||||
|
`
|
||||||
|
|
||||||
|
var csvScenarios = []formatScenario{
|
||||||
|
{
|
||||||
|
description: "Encode CSV simple",
|
||||||
|
input: csvTestSimpleYaml,
|
||||||
|
expected: expectedSimpleCsv,
|
||||||
|
scenarioType: "encode-csv",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: "Encode TSV simple",
|
||||||
|
input: csvTestSimpleYaml,
|
||||||
|
expected: tsvTestExpectedSimpleCsv,
|
||||||
|
scenarioType: "encode-tsv",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: "Encode Empty",
|
||||||
|
skipDoc: true,
|
||||||
|
input: `[]`,
|
||||||
|
expected: "",
|
||||||
|
scenarioType: "encode-csv",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: "Comma in value",
|
||||||
|
skipDoc: true,
|
||||||
|
input: `["comma, in, value", things]`,
|
||||||
|
expected: "\"comma, in, value\",things\n",
|
||||||
|
scenarioType: "encode-csv",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: "Encode array of objects to csv",
|
||||||
|
input: expectedYamlFromCSV,
|
||||||
|
expected: csvSimple,
|
||||||
|
scenarioType: "encode-csv",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: "Encode array of objects to custom csv format",
|
||||||
|
subdescription: "Add the header row manually, then the we convert each object into an array of values - resulting in an array of arrays. Pick the columns and call the header whatever you like.",
|
||||||
|
input: expectedYamlFromCSV,
|
||||||
|
expected: csvSimpleShort,
|
||||||
|
expression: `[["Name", "Number of Cats"]] + [.[] | [.name, .numberOfCats ]]`,
|
||||||
|
scenarioType: "encode-csv",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: "Encode array of objects to csv - missing fields behaviour",
|
||||||
|
subdescription: "First entry is used to determine the headers, and it is missing 'likesApples', so it is not included in the csv. Second entry does not have 'numberOfCats' so that is blank",
|
||||||
|
input: expectedYamlFromCSVMissingData,
|
||||||
|
expected: csvSimpleMissingData,
|
||||||
|
scenarioType: "encode-csv",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: "decode csv missing",
|
||||||
|
skipDoc: true,
|
||||||
|
input: csvMissing,
|
||||||
|
expected: csvMissing,
|
||||||
|
scenarioType: "roundtrip-csv",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: "Parse CSV into an array of objects",
|
||||||
|
subdescription: "First row is assumed to be the header row.",
|
||||||
|
input: csvSimple,
|
||||||
|
expected: expectedYamlFromCSV,
|
||||||
|
scenarioType: "decode-csv-object",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: "Parse TSV into an array of objects",
|
||||||
|
subdescription: "First row is assumed to be the header row.",
|
||||||
|
input: tsvSimple,
|
||||||
|
expected: expectedYamlFromCSV,
|
||||||
|
scenarioType: "decode-tsv-object",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: "Round trip",
|
||||||
|
input: csvSimple,
|
||||||
|
expected: expectedUpdatedSimpleCsv,
|
||||||
|
expression: `(.[] | select(.name == "Gary") | .numberOfCats) = 3`,
|
||||||
|
scenarioType: "roundtrip-csv",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
func testCSVScenario(t *testing.T, s formatScenario) {
|
||||||
|
switch s.scenarioType {
|
||||||
|
case "encode-csv":
|
||||||
|
test.AssertResultWithContext(t, s.expected, mustProcessFormatScenario(s, NewYamlDecoder(ConfiguredYamlPreferences), NewCsvEncoder(',')), s.description)
|
||||||
|
case "encode-tsv":
|
||||||
|
test.AssertResultWithContext(t, s.expected, mustProcessFormatScenario(s, NewYamlDecoder(ConfiguredYamlPreferences), NewCsvEncoder('\t')), s.description)
|
||||||
|
case "decode-csv-object":
|
||||||
|
test.AssertResultWithContext(t, s.expected, mustProcessFormatScenario(s, NewCSVObjectDecoder(','), NewYamlEncoder(2, false, ConfiguredYamlPreferences)), s.description)
|
||||||
|
case "decode-tsv-object":
|
||||||
|
test.AssertResultWithContext(t, s.expected, mustProcessFormatScenario(s, NewCSVObjectDecoder('\t'), NewYamlEncoder(2, false, ConfiguredYamlPreferences)), s.description)
|
||||||
|
case "roundtrip-csv":
|
||||||
|
test.AssertResultWithContext(t, s.expected, mustProcessFormatScenario(s, NewCSVObjectDecoder(','), NewCsvEncoder(',')), s.description)
|
||||||
|
default:
|
||||||
|
panic(fmt.Sprintf("unhandled scenario type %q", s.scenarioType))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func documentCSVDecodeObjectScenario(w *bufio.Writer, s formatScenario, formatType string) {
|
||||||
|
writeOrPanic(w, fmt.Sprintf("## %v\n", s.description))
|
||||||
|
|
||||||
|
if s.subdescription != "" {
|
||||||
|
writeOrPanic(w, s.subdescription)
|
||||||
|
writeOrPanic(w, "\n\n")
|
||||||
|
}
|
||||||
|
|
||||||
|
writeOrPanic(w, fmt.Sprintf("Given a sample.%v file of:\n", formatType))
|
||||||
|
writeOrPanic(w, fmt.Sprintf("```%v\n%v\n```\n", formatType, s.input))
|
||||||
|
|
||||||
|
writeOrPanic(w, "then\n")
|
||||||
|
writeOrPanic(w, fmt.Sprintf("```bash\nyq -p=%v sample.%v\n```\n", formatType, formatType))
|
||||||
|
writeOrPanic(w, "will output\n")
|
||||||
|
|
||||||
|
separator := ','
|
||||||
|
if formatType == "tsv" {
|
||||||
|
separator = '\t'
|
||||||
|
}
|
||||||
|
|
||||||
|
writeOrPanic(w, fmt.Sprintf("```yaml\n%v```\n\n",
|
||||||
|
mustProcessFormatScenario(s, NewCSVObjectDecoder(separator), NewYamlEncoder(s.indent, false, ConfiguredYamlPreferences))),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
func documentCSVEncodeScenario(w *bufio.Writer, s formatScenario, formatType string) {
|
||||||
|
writeOrPanic(w, fmt.Sprintf("## %v\n", s.description))
|
||||||
|
|
||||||
|
if s.subdescription != "" {
|
||||||
|
writeOrPanic(w, s.subdescription)
|
||||||
|
writeOrPanic(w, "\n\n")
|
||||||
|
}
|
||||||
|
|
||||||
|
writeOrPanic(w, "Given a sample.yml file of:\n")
|
||||||
|
writeOrPanic(w, fmt.Sprintf("```yaml\n%v\n```\n", s.input))
|
||||||
|
|
||||||
|
writeOrPanic(w, "then\n")
|
||||||
|
|
||||||
|
expression := s.expression
|
||||||
|
|
||||||
|
if expression != "" {
|
||||||
|
writeOrPanic(w, fmt.Sprintf("```bash\nyq -o=%v '%v' sample.yml\n```\n", formatType, expression))
|
||||||
|
} else {
|
||||||
|
writeOrPanic(w, fmt.Sprintf("```bash\nyq -o=%v sample.yml\n```\n", formatType))
|
||||||
|
}
|
||||||
|
writeOrPanic(w, "will output\n")
|
||||||
|
|
||||||
|
separator := ','
|
||||||
|
if formatType == "tsv" {
|
||||||
|
separator = '\t'
|
||||||
|
}
|
||||||
|
|
||||||
|
writeOrPanic(w, fmt.Sprintf("```%v\n%v```\n\n", formatType,
|
||||||
|
mustProcessFormatScenario(s, NewYamlDecoder(ConfiguredYamlPreferences), NewCsvEncoder(separator))),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
func documentCSVRoundTripScenario(w *bufio.Writer, s formatScenario, formatType string) {
|
||||||
|
writeOrPanic(w, fmt.Sprintf("## %v\n", s.description))
|
||||||
|
|
||||||
|
if s.subdescription != "" {
|
||||||
|
writeOrPanic(w, s.subdescription)
|
||||||
|
writeOrPanic(w, "\n\n")
|
||||||
|
}
|
||||||
|
|
||||||
|
writeOrPanic(w, fmt.Sprintf("Given a sample.%v file of:\n", formatType))
|
||||||
|
writeOrPanic(w, fmt.Sprintf("```%v\n%v\n```\n", formatType, s.input))
|
||||||
|
|
||||||
|
writeOrPanic(w, "then\n")
|
||||||
|
|
||||||
|
expression := s.expression
|
||||||
|
|
||||||
|
if expression != "" {
|
||||||
|
writeOrPanic(w, fmt.Sprintf("```bash\nyq -p=%v -o=%v '%v' sample.%v\n```\n", formatType, formatType, expression, formatType))
|
||||||
|
} else {
|
||||||
|
writeOrPanic(w, fmt.Sprintf("```bash\nyq -p=%v -o=%v sample.%v\n```\n", formatType, formatType, formatType))
|
||||||
|
}
|
||||||
|
writeOrPanic(w, "will output\n")
|
||||||
|
|
||||||
|
separator := ','
|
||||||
|
if formatType == "tsv" {
|
||||||
|
separator = '\t'
|
||||||
|
}
|
||||||
|
|
||||||
|
writeOrPanic(w, fmt.Sprintf("```%v\n%v```\n\n", formatType,
|
||||||
|
mustProcessFormatScenario(s, NewCSVObjectDecoder(separator), NewCsvEncoder(separator))),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
func documentCSVScenario(t *testing.T, w *bufio.Writer, i interface{}) {
|
||||||
|
s := i.(formatScenario)
|
||||||
|
if s.skipDoc {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
switch s.scenarioType {
|
||||||
|
case "encode-csv":
|
||||||
|
documentCSVEncodeScenario(w, s, "csv")
|
||||||
|
case "encode-tsv":
|
||||||
|
documentCSVEncodeScenario(w, s, "tsv")
|
||||||
|
case "decode-csv-object":
|
||||||
|
documentCSVDecodeObjectScenario(w, s, "csv")
|
||||||
|
case "decode-tsv-object":
|
||||||
|
documentCSVDecodeObjectScenario(w, s, "tsv")
|
||||||
|
case "roundtrip-csv":
|
||||||
|
documentCSVRoundTripScenario(w, s, "csv")
|
||||||
|
|
||||||
|
default:
|
||||||
|
panic(fmt.Sprintf("unhandled scenario type %q", s.scenarioType))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestCSVScenarios(t *testing.T) {
|
||||||
|
for _, tt := range csvScenarios {
|
||||||
|
testCSVScenario(t, tt)
|
||||||
|
}
|
||||||
|
genericScenarios := make([]interface{}, len(csvScenarios))
|
||||||
|
for i, s := range csvScenarios {
|
||||||
|
genericScenarios[i] = s
|
||||||
|
}
|
||||||
|
documentScenarios(t, "usage", "csv-tsv", genericScenarios, documentCSVScenario)
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package yqlib
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
)
|
||||||
|
|
||||||
|
type InputFormat uint
|
||||||
|
|
||||||
|
const (
|
||||||
|
YamlInputFormat = 1 << iota
|
||||||
|
XMLInputFormat
|
||||||
|
PropertiesInputFormat
|
||||||
|
Base64InputFormat
|
||||||
|
JsonInputFormat
|
||||||
|
CSVObjectInputFormat
|
||||||
|
TSVObjectInputFormat
|
||||||
|
UriInputFormat
|
||||||
|
)
|
||||||
|
|
||||||
|
type Decoder interface {
|
||||||
|
Init(reader io.Reader) error
|
||||||
|
Decode() (*CandidateNode, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
func InputFormatFromString(format string) (InputFormat, error) {
|
||||||
|
switch format {
|
||||||
|
case "yaml", "y":
|
||||||
|
return YamlInputFormat, nil
|
||||||
|
case "xml", "x":
|
||||||
|
return XMLInputFormat, nil
|
||||||
|
case "props", "p":
|
||||||
|
return PropertiesInputFormat, nil
|
||||||
|
case "json", "ndjson", "j":
|
||||||
|
return JsonInputFormat, nil
|
||||||
|
case "csv", "c":
|
||||||
|
return CSVObjectInputFormat, nil
|
||||||
|
case "tsv", "t":
|
||||||
|
return TSVObjectInputFormat, nil
|
||||||
|
default:
|
||||||
|
return 0, fmt.Errorf("unknown format '%v' please use [yaml|xml|props]", format)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
package yqlib
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"encoding/base64"
|
||||||
|
"io"
|
||||||
|
|
||||||
|
yaml "gopkg.in/yaml.v3"
|
||||||
|
)
|
||||||
|
|
||||||
|
type base64Decoder struct {
|
||||||
|
reader io.Reader
|
||||||
|
finished bool
|
||||||
|
readAnything bool
|
||||||
|
encoding base64.Encoding
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewBase64Decoder() Decoder {
|
||||||
|
return &base64Decoder{finished: false, encoding: *base64.StdEncoding}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (dec *base64Decoder) Init(reader io.Reader) error {
|
||||||
|
dec.reader = reader
|
||||||
|
dec.readAnything = false
|
||||||
|
dec.finished = false
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (dec *base64Decoder) Decode() (*CandidateNode, error) {
|
||||||
|
if dec.finished {
|
||||||
|
return nil, io.EOF
|
||||||
|
}
|
||||||
|
base64Reader := base64.NewDecoder(&dec.encoding, dec.reader)
|
||||||
|
buf := new(bytes.Buffer)
|
||||||
|
|
||||||
|
if _, err := buf.ReadFrom(base64Reader); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if buf.Len() == 0 {
|
||||||
|
dec.finished = true
|
||||||
|
|
||||||
|
// if we've read _only_ an empty string, lets return that
|
||||||
|
// otherwise if we've already read some bytes, and now we get
|
||||||
|
// an empty string, then we are done.
|
||||||
|
if dec.readAnything {
|
||||||
|
return nil, io.EOF
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dec.readAnything = true
|
||||||
|
return &CandidateNode{
|
||||||
|
Node: &yaml.Node{
|
||||||
|
Kind: yaml.ScalarNode,
|
||||||
|
Tag: "!!str",
|
||||||
|
Value: buf.String(),
|
||||||
|
},
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
package yqlib
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/csv"
|
||||||
|
"errors"
|
||||||
|
"io"
|
||||||
|
|
||||||
|
"github.com/dimchansky/utfbom"
|
||||||
|
yaml "gopkg.in/yaml.v3"
|
||||||
|
)
|
||||||
|
|
||||||
|
type csvObjectDecoder struct {
|
||||||
|
separator rune
|
||||||
|
reader csv.Reader
|
||||||
|
finished bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewCSVObjectDecoder(separator rune) Decoder {
|
||||||
|
return &csvObjectDecoder{separator: separator}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (dec *csvObjectDecoder) Init(reader io.Reader) error {
|
||||||
|
cleanReader, enc := utfbom.Skip(reader)
|
||||||
|
log.Debugf("Detected encoding: %s\n", enc)
|
||||||
|
dec.reader = *csv.NewReader(cleanReader)
|
||||||
|
dec.reader.Comma = dec.separator
|
||||||
|
dec.finished = false
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (dec *csvObjectDecoder) convertToYamlNode(content string) *yaml.Node {
|
||||||
|
node, err := parseSnippet(content)
|
||||||
|
if err != nil {
|
||||||
|
return createScalarNode(content, content)
|
||||||
|
}
|
||||||
|
return node
|
||||||
|
}
|
||||||
|
|
||||||
|
func (dec *csvObjectDecoder) createObject(headerRow []string, contentRow []string) *yaml.Node {
|
||||||
|
objectNode := &yaml.Node{Kind: yaml.MappingNode, Tag: "!!map"}
|
||||||
|
|
||||||
|
for i, header := range headerRow {
|
||||||
|
objectNode.Content = append(
|
||||||
|
objectNode.Content,
|
||||||
|
createScalarNode(header, header),
|
||||||
|
dec.convertToYamlNode(contentRow[i]))
|
||||||
|
}
|
||||||
|
return objectNode
|
||||||
|
}
|
||||||
|
|
||||||
|
func (dec *csvObjectDecoder) Decode() (*CandidateNode, error) {
|
||||||
|
if dec.finished {
|
||||||
|
return nil, io.EOF
|
||||||
|
}
|
||||||
|
headerRow, err := dec.reader.Read()
|
||||||
|
log.Debugf(": headerRow%v", headerRow)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
rootArray := &yaml.Node{Kind: yaml.SequenceNode, Tag: "!!seq"}
|
||||||
|
|
||||||
|
contentRow, err := dec.reader.Read()
|
||||||
|
|
||||||
|
for err == nil && len(contentRow) > 0 {
|
||||||
|
log.Debugf("Adding contentRow: %v", contentRow)
|
||||||
|
rootArray.Content = append(rootArray.Content, dec.createObject(headerRow, contentRow))
|
||||||
|
contentRow, err = dec.reader.Read()
|
||||||
|
log.Debugf("Read next contentRow: %v, %v", contentRow, err)
|
||||||
|
}
|
||||||
|
if !errors.Is(err, io.EOF) {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &CandidateNode{
|
||||||
|
Node: &yaml.Node{
|
||||||
|
Kind: yaml.DocumentNode,
|
||||||
|
Content: []*yaml.Node{rootArray},
|
||||||
|
},
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
package yqlib
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
|
||||||
|
"github.com/goccy/go-json"
|
||||||
|
yaml "gopkg.in/yaml.v3"
|
||||||
|
)
|
||||||
|
|
||||||
|
type jsonDecoder struct {
|
||||||
|
decoder json.Decoder
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewJSONDecoder() Decoder {
|
||||||
|
return &jsonDecoder{}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (dec *jsonDecoder) Init(reader io.Reader) error {
|
||||||
|
dec.decoder = *json.NewDecoder(reader)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (dec *jsonDecoder) Decode() (*CandidateNode, error) {
|
||||||
|
|
||||||
|
var dataBucket orderedMap
|
||||||
|
log.Debug("going to decode")
|
||||||
|
err := dec.decoder.Decode(&dataBucket)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
node, err := dec.convertToYamlNode(&dataBucket)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &CandidateNode{
|
||||||
|
Node: &yaml.Node{
|
||||||
|
Kind: yaml.DocumentNode,
|
||||||
|
Content: []*yaml.Node{node},
|
||||||
|
},
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (dec *jsonDecoder) convertToYamlNode(data *orderedMap) (*yaml.Node, error) {
|
||||||
|
if data.kv == nil {
|
||||||
|
switch rawData := data.altVal.(type) {
|
||||||
|
case nil:
|
||||||
|
return createScalarNode(nil, "null"), nil
|
||||||
|
case float64, float32:
|
||||||
|
// json decoder returns ints as float.
|
||||||
|
return parseSnippet(fmt.Sprintf("%v", rawData))
|
||||||
|
case int, int64, int32, string, bool:
|
||||||
|
return createScalarNode(rawData, fmt.Sprintf("%v", rawData)), nil
|
||||||
|
case []*orderedMap:
|
||||||
|
return dec.parseArray(rawData)
|
||||||
|
default:
|
||||||
|
return nil, fmt.Errorf("unrecognised type :( %v", rawData)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var yamlMap = &yaml.Node{Kind: yaml.MappingNode, Tag: "!!map"}
|
||||||
|
for _, keyValuePair := range data.kv {
|
||||||
|
yamlValue, err := dec.convertToYamlNode(&keyValuePair.V)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
yamlMap.Content = append(yamlMap.Content, createScalarNode(keyValuePair.K, keyValuePair.K), yamlValue)
|
||||||
|
}
|
||||||
|
return yamlMap, nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (dec *jsonDecoder) parseArray(dataArray []*orderedMap) (*yaml.Node, error) {
|
||||||
|
|
||||||
|
var yamlMap = &yaml.Node{Kind: yaml.SequenceNode, Tag: "!!seq"}
|
||||||
|
|
||||||
|
for _, value := range dataArray {
|
||||||
|
yamlValue, err := dec.convertToYamlNode(value)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
yamlMap.Content = append(yamlMap.Content, yamlValue)
|
||||||
|
}
|
||||||
|
return yamlMap, nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,161 @@
|
|||||||
|
package yqlib
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/magiconair/properties"
|
||||||
|
"gopkg.in/yaml.v3"
|
||||||
|
)
|
||||||
|
|
||||||
|
type propertiesDecoder struct {
|
||||||
|
reader io.Reader
|
||||||
|
finished bool
|
||||||
|
d DataTreeNavigator
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewPropertiesDecoder() Decoder {
|
||||||
|
return &propertiesDecoder{d: NewDataTreeNavigator(), finished: false}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (dec *propertiesDecoder) Init(reader io.Reader) error {
|
||||||
|
dec.reader = reader
|
||||||
|
dec.finished = false
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func parsePropKey(key string) []interface{} {
|
||||||
|
pathStrArray := strings.Split(key, ".")
|
||||||
|
path := make([]interface{}, len(pathStrArray))
|
||||||
|
for i, pathStr := range pathStrArray {
|
||||||
|
num, err := strconv.ParseInt(pathStr, 10, 32)
|
||||||
|
if err == nil {
|
||||||
|
path[i] = num
|
||||||
|
} else {
|
||||||
|
path[i] = pathStr
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return path
|
||||||
|
}
|
||||||
|
|
||||||
|
func (dec *propertiesDecoder) processComment(c string) string {
|
||||||
|
if c == "" {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return "# " + c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (dec *propertiesDecoder) applyPropertyComments(context Context, path []interface{}, comments []string) error {
|
||||||
|
assignmentOp := &Operation{OperationType: assignOpType, Preferences: assignPreferences{}}
|
||||||
|
|
||||||
|
rhsCandidateNode := &CandidateNode{
|
||||||
|
Path: path,
|
||||||
|
Node: &yaml.Node{
|
||||||
|
Tag: "!!str",
|
||||||
|
Value: fmt.Sprintf("%v", path[len(path)-1]),
|
||||||
|
HeadComment: dec.processComment(strings.Join(comments, "\n")),
|
||||||
|
Kind: yaml.ScalarNode,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
rhsCandidateNode.Node.Tag = guessTagFromCustomType(rhsCandidateNode.Node)
|
||||||
|
|
||||||
|
rhsOp := &Operation{OperationType: referenceOpType, CandidateNode: rhsCandidateNode}
|
||||||
|
|
||||||
|
assignmentOpNode := &ExpressionNode{
|
||||||
|
Operation: assignmentOp,
|
||||||
|
LHS: createTraversalTree(path, traversePreferences{}, true),
|
||||||
|
RHS: &ExpressionNode{Operation: rhsOp},
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err := dec.d.GetMatchingNodes(context, assignmentOpNode)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (dec *propertiesDecoder) applyProperty(context Context, properties *properties.Properties, key string) error {
|
||||||
|
value, _ := properties.Get(key)
|
||||||
|
path := parsePropKey(key)
|
||||||
|
|
||||||
|
propertyComments := properties.GetComments(key)
|
||||||
|
if len(propertyComments) > 0 {
|
||||||
|
err := dec.applyPropertyComments(context, path, propertyComments)
|
||||||
|
if err != nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rhsNode := &yaml.Node{
|
||||||
|
Value: value,
|
||||||
|
Tag: "!!str",
|
||||||
|
Kind: yaml.ScalarNode,
|
||||||
|
}
|
||||||
|
|
||||||
|
rhsNode.Tag = guessTagFromCustomType(rhsNode)
|
||||||
|
|
||||||
|
rhsCandidateNode := &CandidateNode{
|
||||||
|
Path: path,
|
||||||
|
Node: rhsNode,
|
||||||
|
}
|
||||||
|
|
||||||
|
assignmentOp := &Operation{OperationType: assignOpType, Preferences: assignPreferences{}}
|
||||||
|
|
||||||
|
rhsOp := &Operation{OperationType: referenceOpType, CandidateNode: rhsCandidateNode}
|
||||||
|
|
||||||
|
assignmentOpNode := &ExpressionNode{
|
||||||
|
Operation: assignmentOp,
|
||||||
|
LHS: createTraversalTree(path, traversePreferences{}, false),
|
||||||
|
RHS: &ExpressionNode{Operation: rhsOp},
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err := dec.d.GetMatchingNodes(context, assignmentOpNode)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (dec *propertiesDecoder) Decode() (*CandidateNode, error) {
|
||||||
|
if dec.finished {
|
||||||
|
return nil, io.EOF
|
||||||
|
}
|
||||||
|
buf := new(bytes.Buffer)
|
||||||
|
|
||||||
|
if _, err := buf.ReadFrom(dec.reader); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if buf.Len() == 0 {
|
||||||
|
dec.finished = true
|
||||||
|
return nil, io.EOF
|
||||||
|
}
|
||||||
|
properties, err := properties.LoadString(buf.String())
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
properties.DisableExpansion = true
|
||||||
|
|
||||||
|
rootMap := &CandidateNode{
|
||||||
|
Node: &yaml.Node{
|
||||||
|
Kind: yaml.MappingNode,
|
||||||
|
Tag: "!!map",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
context := Context{}
|
||||||
|
context = context.SingleChildContext(rootMap)
|
||||||
|
|
||||||
|
for _, key := range properties.Keys() {
|
||||||
|
if err := dec.applyProperty(context, properties, key); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
dec.finished = true
|
||||||
|
|
||||||
|
return &CandidateNode{
|
||||||
|
Node: &yaml.Node{
|
||||||
|
Kind: yaml.DocumentNode,
|
||||||
|
Content: []*yaml.Node{rootMap.Node},
|
||||||
|
},
|
||||||
|
}, nil
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
package yqlib
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bufio"
|
||||||
|
"bytes"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
type formatScenario struct {
|
||||||
|
input string
|
||||||
|
indent int
|
||||||
|
expression string
|
||||||
|
expected string
|
||||||
|
description string
|
||||||
|
subdescription string
|
||||||
|
skipDoc bool
|
||||||
|
scenarioType string
|
||||||
|
expectedError string
|
||||||
|
}
|
||||||
|
|
||||||
|
func processFormatScenario(s formatScenario, decoder Decoder, encoder Encoder) (string, error) {
|
||||||
|
var output bytes.Buffer
|
||||||
|
writer := bufio.NewWriter(&output)
|
||||||
|
|
||||||
|
if decoder == nil {
|
||||||
|
decoder = NewYamlDecoder(ConfiguredYamlPreferences)
|
||||||
|
}
|
||||||
|
|
||||||
|
inputs, err := readDocuments(strings.NewReader(s.input), "sample.yml", 0, decoder)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
expression := s.expression
|
||||||
|
if expression == "" {
|
||||||
|
expression = "."
|
||||||
|
}
|
||||||
|
|
||||||
|
exp, err := getExpressionParser().ParseExpression(expression)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
context, err := NewDataTreeNavigator().GetMatchingNodes(Context{MatchingNodes: inputs}, exp)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
printer := NewPrinter(encoder, NewSinglePrinterWriter(writer))
|
||||||
|
err = printer.PrintResults(context.MatchingNodes)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
writer.Flush()
|
||||||
|
|
||||||
|
return output.String(), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func mustProcessFormatScenario(s formatScenario, decoder Decoder, encoder Encoder) string {
|
||||||
|
|
||||||
|
result, err := processFormatScenario(s, decoder, encoder)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
package yqlib
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"io"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
|
yaml "gopkg.in/yaml.v3"
|
||||||
|
)
|
||||||
|
|
||||||
|
type uriDecoder struct {
|
||||||
|
reader io.Reader
|
||||||
|
finished bool
|
||||||
|
readAnything bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewUriDecoder() Decoder {
|
||||||
|
return &uriDecoder{finished: false}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (dec *uriDecoder) Init(reader io.Reader) error {
|
||||||
|
dec.reader = reader
|
||||||
|
dec.readAnything = false
|
||||||
|
dec.finished = false
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (dec *uriDecoder) Decode() (*CandidateNode, error) {
|
||||||
|
if dec.finished {
|
||||||
|
return nil, io.EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
buf := new(bytes.Buffer)
|
||||||
|
|
||||||
|
if _, err := buf.ReadFrom(dec.reader); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if buf.Len() == 0 {
|
||||||
|
dec.finished = true
|
||||||
|
|
||||||
|
// if we've read _only_ an empty string, lets return that
|
||||||
|
// otherwise if we've already read some bytes, and now we get
|
||||||
|
// an empty string, then we are done.
|
||||||
|
if dec.readAnything {
|
||||||
|
return nil, io.EOF
|
||||||
|
}
|
||||||
|
}
|
||||||
|
newValue, err := url.QueryUnescape(buf.String())
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
dec.readAnything = true
|
||||||
|
return &CandidateNode{
|
||||||
|
Node: &yaml.Node{
|
||||||
|
Kind: yaml.ScalarNode,
|
||||||
|
Tag: "!!str",
|
||||||
|
Value: newValue,
|
||||||
|
},
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
+201
-53
@@ -2,53 +2,39 @@ package yqlib
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"strings"
|
||||||
"unicode"
|
"unicode"
|
||||||
|
|
||||||
"golang.org/x/net/html/charset"
|
"golang.org/x/net/html/charset"
|
||||||
yaml "gopkg.in/yaml.v3"
|
yaml "gopkg.in/yaml.v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
type InputFormat uint
|
|
||||||
|
|
||||||
const (
|
|
||||||
YamlInputFormat = 1 << iota
|
|
||||||
XmlInputFormat
|
|
||||||
)
|
|
||||||
|
|
||||||
func InputFormatFromString(format string) (InputFormat, error) {
|
|
||||||
switch format {
|
|
||||||
case "yaml", "y":
|
|
||||||
return YamlInputFormat, nil
|
|
||||||
case "xml", "x":
|
|
||||||
return XmlInputFormat, nil
|
|
||||||
default:
|
|
||||||
return 0, fmt.Errorf("unknown format '%v' please use [yaml|xml]", format)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
type xmlDecoder struct {
|
type xmlDecoder struct {
|
||||||
reader io.Reader
|
reader io.Reader
|
||||||
attributePrefix string
|
readAnything bool
|
||||||
contentPrefix string
|
finished bool
|
||||||
finished bool
|
prefs XmlPreferences
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewXmlDecoder(attributePrefix string, contentPrefix string) Decoder {
|
func NewXMLDecoder(prefs XmlPreferences) Decoder {
|
||||||
if contentPrefix == "" {
|
return &xmlDecoder{
|
||||||
contentPrefix = "content"
|
finished: false,
|
||||||
|
prefs: prefs,
|
||||||
}
|
}
|
||||||
return &xmlDecoder{attributePrefix: attributePrefix, contentPrefix: contentPrefix, finished: false}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dec *xmlDecoder) Init(reader io.Reader) {
|
func (dec *xmlDecoder) Init(reader io.Reader) error {
|
||||||
dec.reader = reader
|
dec.reader = reader
|
||||||
|
dec.readAnything = false
|
||||||
dec.finished = false
|
dec.finished = false
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dec *xmlDecoder) createSequence(nodes []*xmlNode) (*yaml.Node, error) {
|
func (dec *xmlDecoder) createSequence(nodes []*xmlNode) (*yaml.Node, error) {
|
||||||
yamlNode := &yaml.Node{Kind: yaml.SequenceNode}
|
yamlNode := &yaml.Node{Kind: yaml.SequenceNode, Tag: "!!seq"}
|
||||||
for _, child := range nodes {
|
for _, child := range nodes {
|
||||||
yamlChild, err := dec.convertToYamlNode(child)
|
yamlChild, err := dec.convertToYamlNode(child)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -60,20 +46,41 @@ func (dec *xmlDecoder) createSequence(nodes []*xmlNode) (*yaml.Node, error) {
|
|||||||
return yamlNode, nil
|
return yamlNode, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (dec *xmlDecoder) processComment(c string) string {
|
||||||
|
if c == "" {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return "#" + strings.TrimRight(c, " ")
|
||||||
|
}
|
||||||
|
|
||||||
func (dec *xmlDecoder) createMap(n *xmlNode) (*yaml.Node, error) {
|
func (dec *xmlDecoder) createMap(n *xmlNode) (*yaml.Node, error) {
|
||||||
yamlNode := &yaml.Node{Kind: yaml.MappingNode, HeadComment: n.Comment}
|
log.Debug("createMap: headC: %v, lineC: %v, footC: %v", n.HeadComment, n.LineComment, n.FootComment)
|
||||||
|
yamlNode := &yaml.Node{Kind: yaml.MappingNode, Tag: "!!map"}
|
||||||
|
|
||||||
if len(n.Data) > 0 {
|
if len(n.Data) > 0 {
|
||||||
label := dec.contentPrefix
|
log.Debugf("creating content node for map: %v", dec.prefs.ContentName)
|
||||||
yamlNode.Content = append(yamlNode.Content, createScalarNode(label, label), createScalarNode(n.Data, n.Data))
|
label := dec.prefs.ContentName
|
||||||
|
labelNode := createScalarNode(label, label)
|
||||||
|
labelNode.HeadComment = dec.processComment(n.HeadComment)
|
||||||
|
labelNode.LineComment = dec.processComment(n.LineComment)
|
||||||
|
labelNode.FootComment = dec.processComment(n.FootComment)
|
||||||
|
yamlNode.Content = append(yamlNode.Content, labelNode, dec.createValueNodeFromData(n.Data))
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, keyValuePair := range n.Children {
|
for i, keyValuePair := range n.Children {
|
||||||
label := keyValuePair.K
|
label := keyValuePair.K
|
||||||
children := keyValuePair.V
|
children := keyValuePair.V
|
||||||
labelNode := createScalarNode(label, label)
|
labelNode := createScalarNode(label, label)
|
||||||
var valueNode *yaml.Node
|
var valueNode *yaml.Node
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
|
if i == 0 {
|
||||||
|
labelNode.HeadComment = dec.processComment(n.HeadComment)
|
||||||
|
|
||||||
|
}
|
||||||
|
log.Debugf("label=%v, i=%v, keyValuePair.FootComment: %v", label, i, keyValuePair.FootComment)
|
||||||
|
labelNode.FootComment = dec.processComment(keyValuePair.FootComment)
|
||||||
|
|
||||||
log.Debug("len of children in %v is %v", label, len(children))
|
log.Debug("len of children in %v is %v", label, len(children))
|
||||||
if len(children) > 1 {
|
if len(children) > 1 {
|
||||||
valueNode, err = dec.createSequence(children)
|
valueNode, err = dec.createSequence(children)
|
||||||
@@ -81,6 +88,21 @@ func (dec *xmlDecoder) createMap(n *xmlNode) (*yaml.Node, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// comment hack for maps of scalars
|
||||||
|
// if the value is a scalar, the head comment of the scalar needs to go on the key?
|
||||||
|
// add tests for <z/> as well as multiple <ds> of inputXmlWithComments > yaml
|
||||||
|
if len(children[0].Children) == 0 && children[0].HeadComment != "" {
|
||||||
|
if len(children[0].Data) > 0 {
|
||||||
|
|
||||||
|
log.Debug("scalar comment hack, currentlabel [%v]", labelNode.HeadComment)
|
||||||
|
labelNode.HeadComment = joinComments([]string{labelNode.HeadComment, strings.TrimSpace(children[0].HeadComment)}, "\n")
|
||||||
|
children[0].HeadComment = ""
|
||||||
|
} else {
|
||||||
|
// child is null, put the headComment as a linecomment for reasons
|
||||||
|
children[0].LineComment = children[0].HeadComment
|
||||||
|
children[0].HeadComment = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
valueNode, err = dec.convertToYamlNode(children[0])
|
valueNode, err = dec.convertToYamlNode(children[0])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -92,46 +114,89 @@ func (dec *xmlDecoder) createMap(n *xmlNode) (*yaml.Node, error) {
|
|||||||
return yamlNode, nil
|
return yamlNode, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (dec *xmlDecoder) createValueNodeFromData(values []string) *yaml.Node {
|
||||||
|
switch len(values) {
|
||||||
|
case 0:
|
||||||
|
return createScalarNode(nil, "")
|
||||||
|
case 1:
|
||||||
|
return createScalarNode(values[0], values[0])
|
||||||
|
default:
|
||||||
|
content := make([]*yaml.Node, 0)
|
||||||
|
for _, value := range values {
|
||||||
|
content = append(content, createScalarNode(value, value))
|
||||||
|
}
|
||||||
|
return &yaml.Node{
|
||||||
|
Kind: yaml.SequenceNode,
|
||||||
|
Tag: "!!seq",
|
||||||
|
Content: content,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (dec *xmlDecoder) convertToYamlNode(n *xmlNode) (*yaml.Node, error) {
|
func (dec *xmlDecoder) convertToYamlNode(n *xmlNode) (*yaml.Node, error) {
|
||||||
if len(n.Children) > 0 {
|
if len(n.Children) > 0 {
|
||||||
return dec.createMap(n)
|
return dec.createMap(n)
|
||||||
}
|
}
|
||||||
scalar := createScalarNode(n.Data, n.Data)
|
|
||||||
scalar.HeadComment = n.Comment
|
scalar := dec.createValueNodeFromData(n.Data)
|
||||||
|
|
||||||
|
log.Debug("scalar (%v), headC: %v, lineC: %v, footC: %v", scalar.Tag, n.HeadComment, n.LineComment, n.FootComment)
|
||||||
|
scalar.HeadComment = dec.processComment(n.HeadComment)
|
||||||
|
scalar.LineComment = dec.processComment(n.LineComment)
|
||||||
|
if scalar.Tag == "!!seq" {
|
||||||
|
scalar.Content[0].HeadComment = scalar.LineComment
|
||||||
|
scalar.LineComment = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
scalar.FootComment = dec.processComment(n.FootComment)
|
||||||
|
|
||||||
return scalar, nil
|
return scalar, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dec *xmlDecoder) Decode(rootYamlNode *yaml.Node) error {
|
func (dec *xmlDecoder) Decode() (*CandidateNode, error) {
|
||||||
if dec.finished {
|
if dec.finished {
|
||||||
return io.EOF
|
return nil, io.EOF
|
||||||
}
|
}
|
||||||
root := &xmlNode{}
|
root := &xmlNode{}
|
||||||
// cant use xj - it doesn't keep map order.
|
// cant use xj - it doesn't keep map order.
|
||||||
err := dec.decodeXml(root)
|
err := dec.decodeXML(root)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return nil, err
|
||||||
}
|
}
|
||||||
firstNode, err := dec.convertToYamlNode(root)
|
firstNode, err := dec.convertToYamlNode(root)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return nil, err
|
||||||
|
} else if firstNode.Tag == "!!null" {
|
||||||
|
dec.finished = true
|
||||||
|
if dec.readAnything {
|
||||||
|
return nil, io.EOF
|
||||||
|
}
|
||||||
}
|
}
|
||||||
rootYamlNode.Kind = yaml.DocumentNode
|
dec.readAnything = true
|
||||||
rootYamlNode.Content = []*yaml.Node{firstNode}
|
|
||||||
dec.finished = true
|
dec.finished = true
|
||||||
return nil
|
|
||||||
|
return &CandidateNode{
|
||||||
|
Node: &yaml.Node{
|
||||||
|
Kind: yaml.DocumentNode,
|
||||||
|
Content: []*yaml.Node{firstNode},
|
||||||
|
},
|
||||||
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type xmlNode struct {
|
type xmlNode struct {
|
||||||
Children []*xmlChildrenKv
|
Children []*xmlChildrenKv
|
||||||
Comment string
|
HeadComment string
|
||||||
Data string
|
FootComment string
|
||||||
|
LineComment string
|
||||||
|
Data []string
|
||||||
}
|
}
|
||||||
|
|
||||||
type xmlChildrenKv struct {
|
type xmlChildrenKv struct {
|
||||||
K string
|
K string
|
||||||
V []*xmlNode
|
V []*xmlNode
|
||||||
|
FootComment string
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddChild appends a node to the list of children
|
// AddChild appends a node to the list of children
|
||||||
@@ -158,31 +223,46 @@ type element struct {
|
|||||||
parent *element
|
parent *element
|
||||||
n *xmlNode
|
n *xmlNode
|
||||||
label string
|
label string
|
||||||
|
state string
|
||||||
}
|
}
|
||||||
|
|
||||||
// this code is heavily based on https://github.com/basgys/goxml2json
|
// this code is heavily based on https://github.com/basgys/goxml2json
|
||||||
// main changes are to decode into a structure that preserves the original order
|
// main changes are to decode into a structure that preserves the original order
|
||||||
// of the map keys.
|
// of the map keys.
|
||||||
func (dec *xmlDecoder) decodeXml(root *xmlNode) error {
|
func (dec *xmlDecoder) decodeXML(root *xmlNode) error {
|
||||||
xmlDec := xml.NewDecoder(dec.reader)
|
xmlDec := xml.NewDecoder(dec.reader)
|
||||||
|
xmlDec.Strict = dec.prefs.StrictMode
|
||||||
// That will convert the charset if the provided XML is non-UTF-8
|
// That will convert the charset if the provided XML is non-UTF-8
|
||||||
xmlDec.CharsetReader = charset.NewReaderLabel
|
xmlDec.CharsetReader = charset.NewReaderLabel
|
||||||
|
|
||||||
|
started := false
|
||||||
|
|
||||||
// Create first element from the root node
|
// Create first element from the root node
|
||||||
elem := &element{
|
elem := &element{
|
||||||
parent: nil,
|
parent: nil,
|
||||||
n: root,
|
n: root,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getToken := func() (xml.Token, error) {
|
||||||
|
if dec.prefs.UseRawToken {
|
||||||
|
return xmlDec.RawToken()
|
||||||
|
}
|
||||||
|
return xmlDec.Token()
|
||||||
|
}
|
||||||
|
|
||||||
for {
|
for {
|
||||||
t, _ := xmlDec.Token()
|
t, e := getToken()
|
||||||
|
if e != nil && !errors.Is(e, io.EOF) {
|
||||||
|
return e
|
||||||
|
}
|
||||||
if t == nil {
|
if t == nil {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
switch se := t.(type) {
|
switch se := t.(type) {
|
||||||
case xml.StartElement:
|
case xml.StartElement:
|
||||||
|
log.Debug("start element %v", se.Name.Local)
|
||||||
|
elem.state = "started"
|
||||||
// Build new a new current element and link it to its parent
|
// Build new a new current element and link it to its parent
|
||||||
elem = &element{
|
elem = &element{
|
||||||
parent: elem,
|
parent: elem,
|
||||||
@@ -192,12 +272,29 @@ func (dec *xmlDecoder) decodeXml(root *xmlNode) error {
|
|||||||
|
|
||||||
// Extract attributes as children
|
// Extract attributes as children
|
||||||
for _, a := range se.Attr {
|
for _, a := range se.Attr {
|
||||||
elem.n.AddChild(dec.attributePrefix+a.Name.Local, &xmlNode{Data: a.Value})
|
if dec.prefs.KeepNamespace {
|
||||||
|
if a.Name.Space != "" {
|
||||||
|
a.Name.Local = a.Name.Space + ":" + a.Name.Local
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elem.n.AddChild(dec.prefs.AttributePrefix+a.Name.Local, &xmlNode{Data: []string{a.Value}})
|
||||||
}
|
}
|
||||||
case xml.CharData:
|
case xml.CharData:
|
||||||
|
|
||||||
// Extract XML data (if any)
|
// Extract XML data (if any)
|
||||||
elem.n.Data = trimNonGraphic(string(se))
|
newBit := trimNonGraphic(string(se))
|
||||||
|
if !started && len(newBit) > 0 {
|
||||||
|
return fmt.Errorf("invalid XML: Encountered chardata [%v] outside of XML node", newBit)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(newBit) > 0 {
|
||||||
|
elem.n.Data = append(elem.n.Data, newBit)
|
||||||
|
elem.state = "chardata"
|
||||||
|
log.Debug("chardata [%v] for %v", elem.n.Data, elem.label)
|
||||||
|
}
|
||||||
case xml.EndElement:
|
case xml.EndElement:
|
||||||
|
log.Debug("end element %v", elem.label)
|
||||||
|
elem.state = "finished"
|
||||||
// And add it to its parent list
|
// And add it to its parent list
|
||||||
if elem.parent != nil {
|
if elem.parent != nil {
|
||||||
elem.parent.n.AddChild(elem.label, elem.n)
|
elem.parent.n.AddChild(elem.label, elem.n)
|
||||||
@@ -206,13 +303,64 @@ func (dec *xmlDecoder) decodeXml(root *xmlNode) error {
|
|||||||
// Then change the current element to its parent
|
// Then change the current element to its parent
|
||||||
elem = elem.parent
|
elem = elem.parent
|
||||||
case xml.Comment:
|
case xml.Comment:
|
||||||
elem.n.Comment = trimNonGraphic(string(xml.CharData(se)))
|
|
||||||
|
commentStr := string(xml.CharData(se))
|
||||||
|
if elem.state == "started" {
|
||||||
|
applyFootComment(elem, commentStr)
|
||||||
|
|
||||||
|
} else if elem.state == "chardata" {
|
||||||
|
log.Debug("got a line comment for (%v) %v: [%v]", elem.state, elem.label, commentStr)
|
||||||
|
elem.n.LineComment = joinComments([]string{elem.n.LineComment, commentStr}, " ")
|
||||||
|
} else {
|
||||||
|
log.Debug("got a head comment for (%v) %v: [%v]", elem.state, elem.label, commentStr)
|
||||||
|
elem.n.HeadComment = joinComments([]string{elem.n.HeadComment, commentStr}, " ")
|
||||||
|
}
|
||||||
|
|
||||||
|
case xml.ProcInst:
|
||||||
|
if !dec.prefs.SkipProcInst {
|
||||||
|
elem.n.AddChild(dec.prefs.ProcInstPrefix+se.Target, &xmlNode{Data: []string{string(se.Inst)}})
|
||||||
|
}
|
||||||
|
case xml.Directive:
|
||||||
|
if !dec.prefs.SkipDirectives {
|
||||||
|
elem.n.AddChild(dec.prefs.DirectiveName, &xmlNode{Data: []string{string(se)}})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
started = true
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func applyFootComment(elem *element, commentStr string) {
|
||||||
|
|
||||||
|
// first lets try to put the comment on the last child
|
||||||
|
if len(elem.n.Children) > 0 {
|
||||||
|
lastChildIndex := len(elem.n.Children) - 1
|
||||||
|
childKv := elem.n.Children[lastChildIndex]
|
||||||
|
log.Debug("got a foot comment, putting on last child for %v: [%v]", childKv.K, commentStr)
|
||||||
|
// if it's an array of scalars, put the foot comment on the scalar itself
|
||||||
|
if len(childKv.V) > 0 && len(childKv.V[0].Children) == 0 {
|
||||||
|
nodeToUpdate := childKv.V[len(childKv.V)-1]
|
||||||
|
nodeToUpdate.FootComment = joinComments([]string{nodeToUpdate.FootComment, commentStr}, " ")
|
||||||
|
} else {
|
||||||
|
childKv.FootComment = joinComments([]string{elem.n.FootComment, commentStr}, " ")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.Debug("got a foot comment for %v: [%v]", elem.label, commentStr)
|
||||||
|
elem.n.FootComment = joinComments([]string{elem.n.FootComment, commentStr}, " ")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func joinComments(rawStrings []string, joinStr string) string {
|
||||||
|
stringsToJoin := make([]string, 0)
|
||||||
|
for _, str := range rawStrings {
|
||||||
|
if str != "" {
|
||||||
|
stringsToJoin = append(stringsToJoin, str)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return strings.Join(stringsToJoin, joinStr)
|
||||||
|
}
|
||||||
|
|
||||||
// trimNonGraphic returns a slice of the string s, with all leading and trailing
|
// trimNonGraphic returns a slice of the string s, with all leading and trailing
|
||||||
// non graphic characters and spaces removed.
|
// non graphic characters and spaces removed.
|
||||||
//
|
//
|
||||||
|
|||||||
+126
-11
@@ -1,28 +1,143 @@
|
|||||||
package yqlib
|
package yqlib
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bufio"
|
||||||
|
"bytes"
|
||||||
|
"errors"
|
||||||
"io"
|
"io"
|
||||||
|
"regexp"
|
||||||
|
"strings"
|
||||||
|
|
||||||
yaml "gopkg.in/yaml.v3"
|
yaml "gopkg.in/yaml.v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Decoder interface {
|
|
||||||
Init(reader io.Reader)
|
|
||||||
Decode(node *yaml.Node) error
|
|
||||||
}
|
|
||||||
|
|
||||||
type yamlDecoder struct {
|
type yamlDecoder struct {
|
||||||
decoder yaml.Decoder
|
decoder yaml.Decoder
|
||||||
|
|
||||||
|
prefs YamlPreferences
|
||||||
|
|
||||||
|
// work around of various parsing issues by yaml.v3 with document headers
|
||||||
|
leadingContent string
|
||||||
|
bufferRead bytes.Buffer
|
||||||
|
|
||||||
|
readAnything bool
|
||||||
|
firstFile bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewYamlDecoder() Decoder {
|
func NewYamlDecoder(prefs YamlPreferences) Decoder {
|
||||||
return &yamlDecoder{}
|
return &yamlDecoder{prefs: prefs, firstFile: true}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dec *yamlDecoder) Init(reader io.Reader) {
|
func (dec *yamlDecoder) processReadStream(reader *bufio.Reader) (io.Reader, string, error) {
|
||||||
dec.decoder = *yaml.NewDecoder(reader)
|
var commentLineRegEx = regexp.MustCompile(`^\s*#`)
|
||||||
|
var yamlDirectiveLineRegEx = regexp.MustCompile(`^\s*%YA`)
|
||||||
|
var sb strings.Builder
|
||||||
|
for {
|
||||||
|
peekBytes, err := reader.Peek(3)
|
||||||
|
if errors.Is(err, io.EOF) {
|
||||||
|
// EOF are handled else where..
|
||||||
|
return reader, sb.String(), nil
|
||||||
|
} else if err != nil {
|
||||||
|
return reader, sb.String(), err
|
||||||
|
} else if string(peekBytes[0]) == "\n" {
|
||||||
|
_, err := reader.ReadString('\n')
|
||||||
|
sb.WriteString("\n")
|
||||||
|
if errors.Is(err, io.EOF) {
|
||||||
|
return reader, sb.String(), nil
|
||||||
|
} else if err != nil {
|
||||||
|
return reader, sb.String(), err
|
||||||
|
}
|
||||||
|
} else if string(peekBytes) == "---" {
|
||||||
|
_, err := reader.ReadString('\n')
|
||||||
|
sb.WriteString("$yqDocSeperator$\n")
|
||||||
|
if errors.Is(err, io.EOF) {
|
||||||
|
return reader, sb.String(), nil
|
||||||
|
} else if err != nil {
|
||||||
|
return reader, sb.String(), err
|
||||||
|
}
|
||||||
|
} else if commentLineRegEx.MatchString(string(peekBytes)) || yamlDirectiveLineRegEx.MatchString(string(peekBytes)) {
|
||||||
|
line, err := reader.ReadString('\n')
|
||||||
|
sb.WriteString(line)
|
||||||
|
if errors.Is(err, io.EOF) {
|
||||||
|
return reader, sb.String(), nil
|
||||||
|
} else if err != nil {
|
||||||
|
return reader, sb.String(), err
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return reader, sb.String(), nil
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dec *yamlDecoder) Decode(rootYamlNode *yaml.Node) error {
|
func (dec *yamlDecoder) Init(reader io.Reader) error {
|
||||||
return dec.decoder.Decode(rootYamlNode)
|
readerToUse := reader
|
||||||
|
leadingContent := ""
|
||||||
|
dec.bufferRead = bytes.Buffer{}
|
||||||
|
var err error
|
||||||
|
// if we 'evaluating together' - we only process the leading content
|
||||||
|
// of the first file - this ensures comments from subsequent files are
|
||||||
|
// merged together correctly.
|
||||||
|
if dec.prefs.LeadingContentPreProcessing && (!dec.prefs.EvaluateTogether || dec.firstFile) {
|
||||||
|
readerToUse, leadingContent, err = dec.processReadStream(bufio.NewReader(reader))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
} else if !dec.prefs.LeadingContentPreProcessing {
|
||||||
|
// if we're not process the leading content
|
||||||
|
// keep a copy of what we've read. This is incase its a
|
||||||
|
// doc with only comments - the decoder will return nothing
|
||||||
|
// then we can read the comments from bufferRead
|
||||||
|
readerToUse = io.TeeReader(reader, &dec.bufferRead)
|
||||||
|
}
|
||||||
|
dec.leadingContent = leadingContent
|
||||||
|
dec.readAnything = false
|
||||||
|
dec.decoder = *yaml.NewDecoder(readerToUse)
|
||||||
|
dec.firstFile = false
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (dec *yamlDecoder) Decode() (*CandidateNode, error) {
|
||||||
|
var dataBucket yaml.Node
|
||||||
|
err := dec.decoder.Decode(&dataBucket)
|
||||||
|
if errors.Is(err, io.EOF) && dec.leadingContent != "" && !dec.readAnything {
|
||||||
|
// force returning an empty node with a comment.
|
||||||
|
dec.readAnything = true
|
||||||
|
return dec.blankNodeWithComment(), nil
|
||||||
|
} else if errors.Is(err, io.EOF) && !dec.prefs.LeadingContentPreProcessing && !dec.readAnything {
|
||||||
|
// didn't find any yaml,
|
||||||
|
// check the tee buffer, maybe there were comments
|
||||||
|
dec.readAnything = true
|
||||||
|
dec.leadingContent = dec.bufferRead.String()
|
||||||
|
if dec.leadingContent != "" {
|
||||||
|
return dec.blankNodeWithComment(), nil
|
||||||
|
}
|
||||||
|
return nil, err
|
||||||
|
} else if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
candidateNode := &CandidateNode{
|
||||||
|
Node: &dataBucket,
|
||||||
|
}
|
||||||
|
|
||||||
|
if dec.leadingContent != "" {
|
||||||
|
candidateNode.LeadingContent = dec.leadingContent
|
||||||
|
dec.leadingContent = ""
|
||||||
|
}
|
||||||
|
dec.readAnything = true
|
||||||
|
// move document comments into candidate node
|
||||||
|
// otherwise unwrap drops them.
|
||||||
|
candidateNode.TrailingContent = dataBucket.FootComment
|
||||||
|
dataBucket.FootComment = ""
|
||||||
|
return candidateNode, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (dec *yamlDecoder) blankNodeWithComment() *CandidateNode {
|
||||||
|
return &CandidateNode{
|
||||||
|
Document: 0,
|
||||||
|
Filename: "",
|
||||||
|
Node: &yaml.Node{Kind: yaml.DocumentNode, Content: []*yaml.Node{{Tag: "!!null", Kind: yaml.ScalarNode}}},
|
||||||
|
FileIndex: 0,
|
||||||
|
LeadingContent: dec.leadingContent,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+172
-103
@@ -4,31 +4,10 @@ Add behaves differently according to the type of the LHS:
|
|||||||
* arrays: concatenate
|
* arrays: concatenate
|
||||||
* number scalars: arithmetic addition
|
* number scalars: arithmetic addition
|
||||||
* string scalars: concatenate
|
* string scalars: concatenate
|
||||||
|
* maps: shallow merge (use the multiply operator (`*`) to deeply merge)
|
||||||
|
|
||||||
Use `+=` as append assign for things like increment. Note that `.a += .x` is equivalent to running `.a = .a + .x`.
|
Use `+=` as a relative append assign for things like increment. Note that `.a += .x` is equivalent to running `.a = .a + .x`.
|
||||||
|
|
||||||
## Concatenate and assign arrays
|
|
||||||
Given a sample.yml file of:
|
|
||||||
```yaml
|
|
||||||
a:
|
|
||||||
val: thing
|
|
||||||
b:
|
|
||||||
- cat
|
|
||||||
- dog
|
|
||||||
```
|
|
||||||
then
|
|
||||||
```bash
|
|
||||||
yq eval '.a.b += ["cow"]' sample.yml
|
|
||||||
```
|
|
||||||
will output
|
|
||||||
```yaml
|
|
||||||
a:
|
|
||||||
val: thing
|
|
||||||
b:
|
|
||||||
- cat
|
|
||||||
- dog
|
|
||||||
- cow
|
|
||||||
```
|
|
||||||
|
|
||||||
## Concatenate arrays
|
## Concatenate arrays
|
||||||
Given a sample.yml file of:
|
Given a sample.yml file of:
|
||||||
@@ -42,7 +21,7 @@ b:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.a + .b' sample.yml
|
yq '.a + .b' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -52,6 +31,28 @@ will output
|
|||||||
- 4
|
- 4
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Concatenate to existing array
|
||||||
|
Note that the styling of `a` is kept.
|
||||||
|
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
a: [1,2]
|
||||||
|
b:
|
||||||
|
- 3
|
||||||
|
- 4
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq '.a += .b' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
a: [1, 2, 3, 4]
|
||||||
|
b:
|
||||||
|
- 3
|
||||||
|
- 4
|
||||||
|
```
|
||||||
|
|
||||||
## Concatenate null to array
|
## Concatenate null to array
|
||||||
Given a sample.yml file of:
|
Given a sample.yml file of:
|
||||||
```yaml
|
```yaml
|
||||||
@@ -61,7 +62,7 @@ a:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.a + null' sample.yml
|
yq '.a + null' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -69,6 +70,39 @@ will output
|
|||||||
- 2
|
- 2
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Append to existing array
|
||||||
|
Note that the styling is copied from existing array elements
|
||||||
|
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
a: ['dog']
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq '.a += "cat"' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
a: ['dog', 'cat']
|
||||||
|
```
|
||||||
|
|
||||||
|
## Prepend to existing array
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
a:
|
||||||
|
- dog
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq '.a = ["cat"] + .a' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
a:
|
||||||
|
- cat
|
||||||
|
- dog
|
||||||
|
```
|
||||||
|
|
||||||
## Add new object to array
|
## Add new object to array
|
||||||
Given a sample.yml file of:
|
Given a sample.yml file of:
|
||||||
```yaml
|
```yaml
|
||||||
@@ -77,7 +111,7 @@ a:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.a + {"cat": "meow"}' sample.yml
|
yq '.a + {"cat": "meow"}' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -85,76 +119,6 @@ will output
|
|||||||
- cat: meow
|
- cat: meow
|
||||||
```
|
```
|
||||||
|
|
||||||
## Add string to array
|
|
||||||
Given a sample.yml file of:
|
|
||||||
```yaml
|
|
||||||
a:
|
|
||||||
- 1
|
|
||||||
- 2
|
|
||||||
```
|
|
||||||
then
|
|
||||||
```bash
|
|
||||||
yq eval '.a + "hello"' sample.yml
|
|
||||||
```
|
|
||||||
will output
|
|
||||||
```yaml
|
|
||||||
- 1
|
|
||||||
- 2
|
|
||||||
- hello
|
|
||||||
```
|
|
||||||
|
|
||||||
## Append to array
|
|
||||||
Given a sample.yml file of:
|
|
||||||
```yaml
|
|
||||||
a:
|
|
||||||
- 1
|
|
||||||
- 2
|
|
||||||
b:
|
|
||||||
- 3
|
|
||||||
- 4
|
|
||||||
```
|
|
||||||
then
|
|
||||||
```bash
|
|
||||||
yq eval '.a = .a + .b' sample.yml
|
|
||||||
```
|
|
||||||
will output
|
|
||||||
```yaml
|
|
||||||
a:
|
|
||||||
- 1
|
|
||||||
- 2
|
|
||||||
- 3
|
|
||||||
- 4
|
|
||||||
b:
|
|
||||||
- 3
|
|
||||||
- 4
|
|
||||||
```
|
|
||||||
|
|
||||||
## Append another array using +=
|
|
||||||
Given a sample.yml file of:
|
|
||||||
```yaml
|
|
||||||
a:
|
|
||||||
- 1
|
|
||||||
- 2
|
|
||||||
b:
|
|
||||||
- 3
|
|
||||||
- 4
|
|
||||||
```
|
|
||||||
then
|
|
||||||
```bash
|
|
||||||
yq eval '.a += .b' sample.yml
|
|
||||||
```
|
|
||||||
will output
|
|
||||||
```yaml
|
|
||||||
a:
|
|
||||||
- 1
|
|
||||||
- 2
|
|
||||||
- 3
|
|
||||||
- 4
|
|
||||||
b:
|
|
||||||
- 3
|
|
||||||
- 4
|
|
||||||
```
|
|
||||||
|
|
||||||
## Relative append
|
## Relative append
|
||||||
Given a sample.yml file of:
|
Given a sample.yml file of:
|
||||||
```yaml
|
```yaml
|
||||||
@@ -169,7 +133,7 @@ a:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.a[].b += ["mouse"]' sample.yml
|
yq '.a[].b += ["mouse"]' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -182,7 +146,9 @@ a:
|
|||||||
b:
|
b:
|
||||||
- dog
|
- dog
|
||||||
- mouse
|
- mouse
|
||||||
a3: {b: [mouse]}
|
a3:
|
||||||
|
b:
|
||||||
|
- mouse
|
||||||
```
|
```
|
||||||
|
|
||||||
## String concatenation
|
## String concatenation
|
||||||
@@ -193,7 +159,7 @@ b: meow
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.a = .a + .b' sample.yml
|
yq '.a += .b' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -211,7 +177,7 @@ b: 4.9
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.a = .a + .b' sample.yml
|
yq '.a = .a + .b' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -229,7 +195,7 @@ b: 4
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.a = .a + .b' sample.yml
|
yq '.a = .a + .b' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -245,7 +211,7 @@ b: 5
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.[] += 1' sample.yml
|
yq '.[] += 1' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -253,15 +219,118 @@ a: 4
|
|||||||
b: 6
|
b: 6
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Date addition
|
||||||
|
You can add durations to dates. Assumes RFC3339 date time format, see [date-time operators](https://mikefarah.gitbook.io/yq/operators/date-time-operators) for more information.
|
||||||
|
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
a: 2021-01-01T00:00:00Z
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq '.a += "3h10m"' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
a: 2021-01-01T03:10:00Z
|
||||||
|
```
|
||||||
|
|
||||||
|
## Date addition - custom format
|
||||||
|
You can add durations to dates. See [date-time operators](https://mikefarah.gitbook.io/yq/operators/date-time-operators) for more information.
|
||||||
|
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
a: Saturday, 15-Dec-01 at 2:59AM GMT
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq 'with_dtf("Monday, 02-Jan-06 at 3:04PM MST", .a += "3h1m")' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
a: Saturday, 15-Dec-01 at 6:00AM GMT
|
||||||
|
```
|
||||||
|
|
||||||
## Add to null
|
## Add to null
|
||||||
Adding to null simply returns the rhs
|
Adding to null simply returns the rhs
|
||||||
|
|
||||||
Running
|
Running
|
||||||
```bash
|
```bash
|
||||||
yq eval --null-input 'null + "cat"'
|
yq --null-input 'null + "cat"'
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
cat
|
cat
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Add maps to shallow merge
|
||||||
|
Adding objects together shallow merges them. Use `*` to deeply merge.
|
||||||
|
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
a:
|
||||||
|
thing:
|
||||||
|
name: Astuff
|
||||||
|
value: x
|
||||||
|
a1: cool
|
||||||
|
b:
|
||||||
|
thing:
|
||||||
|
name: Bstuff
|
||||||
|
legs: 3
|
||||||
|
b1: neat
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq '.a += .b' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
a:
|
||||||
|
thing:
|
||||||
|
name: Bstuff
|
||||||
|
legs: 3
|
||||||
|
a1: cool
|
||||||
|
b1: neat
|
||||||
|
b:
|
||||||
|
thing:
|
||||||
|
name: Bstuff
|
||||||
|
legs: 3
|
||||||
|
b1: neat
|
||||||
|
```
|
||||||
|
|
||||||
|
## Custom types: that are really strings
|
||||||
|
When custom tags are encountered, yq will try to decode the underlying type.
|
||||||
|
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
a: !horse cat
|
||||||
|
b: !goat _meow
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq '.a += .b' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
a: !horse cat_meow
|
||||||
|
b: !goat _meow
|
||||||
|
```
|
||||||
|
|
||||||
|
## Custom types: that are really numbers
|
||||||
|
When custom tags are encountered, yq will try to decode the underlying type.
|
||||||
|
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
a: !horse 1.2
|
||||||
|
b: !goat 2.3
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq '.a += .b' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
a: !horse 3.5
|
||||||
|
b: !goat 2.3
|
||||||
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ a: bridge
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.a // "hello"' sample.yml
|
yq '.a // "hello"' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -23,7 +23,7 @@ Given a sample.yml file of:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.a // "hello"' sample.yml
|
yq '.a // "hello"' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -37,7 +37,7 @@ a: ~
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.a // "hello"' sample.yml
|
yq '.a // "hello"' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -51,7 +51,7 @@ a: false
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.a // "hello"' sample.yml
|
yq '.a // "hello"' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -66,10 +66,43 @@ b: cat
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.a // .b' sample.yml
|
yq '.a // .b' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
cat
|
cat
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Update or create - entity exists
|
||||||
|
This initialises `a` if it's not present
|
||||||
|
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
a: 1
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq '(.a // (.a = 0)) += 1' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
a: 2
|
||||||
|
```
|
||||||
|
|
||||||
|
## Update or create - entity does not exist
|
||||||
|
This initialises `a` if it's not present
|
||||||
|
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
b: camel
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq '(.a // (.a = 0)) += 1' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
b: camel
|
||||||
|
a: 1
|
||||||
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ Given a sample.yml file of:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.[4] | explode(.)' sample.yml
|
yq '.[4] | explode(.)' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -55,7 +55,7 @@ Given a sample.yml file of:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.[4] | explode(.)' sample.yml
|
yq '.[4] | explode(.)' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -87,7 +87,7 @@ Given a sample.yml file of:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.[4] | explode(.)' sample.yml
|
yq '.[4] | explode(.)' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -103,7 +103,7 @@ a: &billyBob cat
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.a | anchor' sample.yml
|
yq '.a | anchor' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -117,7 +117,7 @@ a: cat
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.a anchor = "foobar"' sample.yml
|
yq '.a anchor = "foobar"' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -132,7 +132,7 @@ a:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.a anchor |= .b' sample.yml
|
yq '.a anchor |= .b' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -148,7 +148,7 @@ a: *billyBob
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.a | alias' sample.yml
|
yq '.a | alias' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -163,7 +163,7 @@ a: cat
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.a alias = "meow"' sample.yml
|
yq '.a alias = "meow"' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -179,7 +179,7 @@ a: cat
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.a alias = ""' sample.yml
|
yq '.a alias = ""' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -196,7 +196,7 @@ a:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.a alias |= .f' sample.yml
|
yq '.a alias |= .f' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -213,7 +213,7 @@ f:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval 'explode(.f)' sample.yml
|
yq 'explode(.f)' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -229,7 +229,7 @@ a: mike
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval 'explode(.a)' sample.yml
|
yq 'explode(.a)' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -245,7 +245,7 @@ f:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval 'explode(.f)' sample.yml
|
yq 'explode(.f)' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -278,7 +278,7 @@ foobar:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval 'explode(.)' sample.yml
|
yq 'explode(.)' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -317,7 +317,7 @@ thingTwo:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.thingOne |= explode(.) * {"value": false}' sample.yml
|
yq '.thingOne |= explode(.) * {"value": false}' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
# Array to Map
|
||||||
|
|
||||||
|
Use this operator to convert an array to..a map. The indices are used as map keys, null values in the array are skipped over.
|
||||||
|
|
||||||
|
Behind the scenes, this is implemented using reduce:
|
||||||
|
|
||||||
|
```
|
||||||
|
(.[] | select(. != null) ) as $i ireduce({}; .[$i | key] = $i)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Simple example
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
cool:
|
||||||
|
- null
|
||||||
|
- null
|
||||||
|
- hello
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq '.cool |= array_to_map' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
cool:
|
||||||
|
2: hello
|
||||||
|
```
|
||||||
|
|
||||||
@@ -7,10 +7,15 @@ Which will assign the LHS node values to the RHS node values. The RHS expression
|
|||||||
|
|
||||||
### relative form: `|=`
|
### relative form: `|=`
|
||||||
This will do a similar thing to the plain form, however, the RHS expression is run against _the LHS nodes_. This is useful for updating values based on old values, e.g. increment.
|
This will do a similar thing to the plain form, however, the RHS expression is run against _the LHS nodes_. This is useful for updating values based on old values, e.g. increment.
|
||||||
|
|
||||||
|
|
||||||
|
### Flags
|
||||||
|
- `c` clobber custom tags
|
||||||
|
|
||||||
## Create yaml file
|
## Create yaml file
|
||||||
Running
|
Running
|
||||||
```bash
|
```bash
|
||||||
yq eval --null-input '.a.b = "cat" | .x = "frog"'
|
yq --null-input '.a.b = "cat" | .x = "frog"'
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -28,7 +33,7 @@ a:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.a |= .b' sample.yml
|
yq '.a |= .b' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -45,7 +50,7 @@ Given a sample.yml file of:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.[] |= . * 2' sample.yml
|
yq '.[] |= . * 2' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -84,7 +89,7 @@ b: sibling
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.a = .b' sample.yml
|
yq '.a = .b' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -101,13 +106,13 @@ c: fieldC
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '(.a, .c) = "potatoe"' sample.yml
|
yq '(.a, .c) = "potato"' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
a: potatoe
|
a: potato
|
||||||
b: fieldB
|
b: fieldB
|
||||||
c: potatoe
|
c: potato
|
||||||
```
|
```
|
||||||
|
|
||||||
## Update string value
|
## Update string value
|
||||||
@@ -118,7 +123,7 @@ a:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.a.b = "frog"' sample.yml
|
yq '.a.b = "frog"' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -136,7 +141,7 @@ a:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.a.b |= "frog"' sample.yml
|
yq '.a.b |= "frog"' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -145,7 +150,7 @@ a:
|
|||||||
```
|
```
|
||||||
|
|
||||||
## Update deeply selected results
|
## Update deeply selected results
|
||||||
Note that the LHS is wrapped in brackets! This is to ensure we dont first filter out the yaml and then update the snippet.
|
Note that the LHS is wrapped in brackets! This is to ensure we don't first filter out the yaml and then update the snippet.
|
||||||
|
|
||||||
Given a sample.yml file of:
|
Given a sample.yml file of:
|
||||||
```yaml
|
```yaml
|
||||||
@@ -155,7 +160,7 @@ a:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '(.a[] | select(. == "apple")) = "frog"' sample.yml
|
yq '(.a[] | select(. == "apple")) = "frog"' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -173,7 +178,7 @@ Given a sample.yml file of:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '(.[] | select(. == "*andy")) = "bogs"' sample.yml
|
yq '(.[] | select(. == "*andy")) = "bogs"' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -189,11 +194,12 @@ Given a sample.yml file of:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.a.b |= "bogs"' sample.yml
|
yq '.a.b |= "bogs"' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
{a: {b: bogs}}
|
a:
|
||||||
|
b: bogs
|
||||||
```
|
```
|
||||||
|
|
||||||
## Update node value that has an anchor
|
## Update node value that has an anchor
|
||||||
@@ -205,7 +211,7 @@ a: &cool cat
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.a = "dog"' sample.yml
|
yq '.a = "dog"' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -219,10 +225,46 @@ Given a sample.yml file of:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.a.b.[0] |= "bogs"' sample.yml
|
yq '.a.b.[0] |= "bogs"' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
{a: {b: [bogs]}}
|
a:
|
||||||
|
b:
|
||||||
|
- bogs
|
||||||
|
```
|
||||||
|
|
||||||
|
## Custom types are maintained by default
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
a: !cat meow
|
||||||
|
b: !dog woof
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq '.a = .b' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
a: !cat woof
|
||||||
|
b: !dog woof
|
||||||
|
```
|
||||||
|
|
||||||
|
## Custom types: clovver
|
||||||
|
Use the `c` option to clobber custom tags
|
||||||
|
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
a: !cat meow
|
||||||
|
b: !dog woof
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq '.a =c .b' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
a: !dog woof
|
||||||
|
b: !dog woof
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -10,10 +10,16 @@ The `or` and `and` operators take two parameters and return a boolean result.
|
|||||||
|
|
||||||
These are most commonly used with the `select` operator to filter particular nodes.
|
These are most commonly used with the `select` operator to filter particular nodes.
|
||||||
|
|
||||||
|
## Related Operators
|
||||||
|
|
||||||
|
- equals / not equals (`==`, `!=`) operators [here](https://mikefarah.gitbook.io/yq/operators/equals)
|
||||||
|
- comparison (`>=`, `<` etc) operators [here](https://mikefarah.gitbook.io/yq/operators/compare)
|
||||||
|
- select operator [here](https://mikefarah.gitbook.io/yq/operators/select)
|
||||||
|
|
||||||
## `or` example
|
## `or` example
|
||||||
Running
|
Running
|
||||||
```bash
|
```bash
|
||||||
yq eval --null-input 'true or false'
|
yq --null-input 'true or false'
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -23,7 +29,7 @@ true
|
|||||||
## `and` example
|
## `and` example
|
||||||
Running
|
Running
|
||||||
```bash
|
```bash
|
||||||
yq eval --null-input 'true and false'
|
yq --null-input 'true and false'
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -42,7 +48,7 @@ Given a sample.yml file of:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '[.[] | select(.a == "cat" or .b == "dog")]' sample.yml
|
yq '[.[] | select(.a == "cat" or .b == "dog")]' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -60,7 +66,7 @@ Given a sample.yml file of:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval 'any' sample.yml
|
yq 'any' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -74,7 +80,7 @@ Given a sample.yml file of:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval 'any' sample.yml
|
yq 'any' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -93,7 +99,7 @@ b:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.[] |= any_c(. == "awesome")' sample.yml
|
yq '.[] |= any_c(. == "awesome")' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -109,7 +115,7 @@ Given a sample.yml file of:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval 'all' sample.yml
|
yq 'all' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -123,7 +129,7 @@ Given a sample.yml file of:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval 'all' sample.yml
|
yq 'all' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -142,7 +148,7 @@ b:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.[] |= all_c(tag == "!!str")' sample.yml
|
yq '.[] |= all_c(tag == "!!str")' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -153,7 +159,7 @@ b: false
|
|||||||
## Not true is false
|
## Not true is false
|
||||||
Running
|
Running
|
||||||
```bash
|
```bash
|
||||||
yq eval --null-input 'true | not'
|
yq --null-input 'true | not'
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -163,7 +169,7 @@ false
|
|||||||
## Not false is true
|
## Not false is true
|
||||||
Running
|
Running
|
||||||
```bash
|
```bash
|
||||||
yq eval --null-input 'false | not'
|
yq --null-input 'false | not'
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -173,7 +179,7 @@ true
|
|||||||
## String values considered to be true
|
## String values considered to be true
|
||||||
Running
|
Running
|
||||||
```bash
|
```bash
|
||||||
yq eval --null-input '"cat" | not'
|
yq --null-input '"cat" | not'
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -183,7 +189,7 @@ false
|
|||||||
## Empty string value considered to be true
|
## Empty string value considered to be true
|
||||||
Running
|
Running
|
||||||
```bash
|
```bash
|
||||||
yq eval --null-input '"" | not'
|
yq --null-input '"" | not'
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -193,7 +199,7 @@ false
|
|||||||
## Numbers are considered to be true
|
## Numbers are considered to be true
|
||||||
Running
|
Running
|
||||||
```bash
|
```bash
|
||||||
yq eval --null-input '1 | not'
|
yq --null-input '1 | not'
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -203,7 +209,7 @@ false
|
|||||||
## Zero is considered to be true
|
## Zero is considered to be true
|
||||||
Running
|
Running
|
||||||
```bash
|
```bash
|
||||||
yq eval --null-input '0 | not'
|
yq --null-input '0 | not'
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -213,7 +219,7 @@ false
|
|||||||
## Null is considered to be false
|
## Null is considered to be false
|
||||||
Running
|
Running
|
||||||
```bash
|
```bash
|
||||||
yq eval --null-input '~ | not'
|
yq --null-input '~ | not'
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ This creates an array using the expression between the square brackets.
|
|||||||
## Collect empty
|
## Collect empty
|
||||||
Running
|
Running
|
||||||
```bash
|
```bash
|
||||||
yq eval --null-input '[]'
|
yq --null-input '[]'
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -16,7 +16,7 @@ will output
|
|||||||
## Collect single
|
## Collect single
|
||||||
Running
|
Running
|
||||||
```bash
|
```bash
|
||||||
yq eval --null-input '["cat"]'
|
yq --null-input '["cat"]'
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -31,7 +31,7 @@ b: dog
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '[.a, .b]' sample.yml
|
yq '[.a, .b]' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
# Column
|
||||||
|
|
||||||
|
Returns the column of the matching node. Starts from 1, 0 indicates there was no column data.
|
||||||
|
|
||||||
|
## Returns column of _value_ node
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
a: cat
|
||||||
|
b: bob
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq '.b | column' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
4
|
||||||
|
```
|
||||||
|
|
||||||
|
## Returns column of _key_ node
|
||||||
|
Pipe through the key operator to get the column of the key
|
||||||
|
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
a: cat
|
||||||
|
b: bob
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq '.b | key | column' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
1
|
||||||
|
```
|
||||||
|
|
||||||
|
## First column is 1
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
a: cat
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq '.a | key | column' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
1
|
||||||
|
```
|
||||||
|
|
||||||
|
## No column data is 0
|
||||||
|
Running
|
||||||
|
```bash
|
||||||
|
yq --null-input '{"a": "new entry"} | column'
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
0
|
||||||
|
```
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
# Comment Operators
|
# Comment Operators
|
||||||
|
|
||||||
Use these comment operators to set or retrieve comments.
|
Use these comment operators to set or retrieve comments. Note that line comments on maps/arrays are actually set on the _key_ node as opposed to the _value_ (map/array). See below for examples.
|
||||||
|
|
||||||
Like the `=` and `|=` assign operators, the same syntax applies when updating comments:
|
Like the `=` and `|=` assign operators, the same syntax applies when updating comments:
|
||||||
|
|
||||||
@@ -11,19 +11,39 @@ This will assign the LHS nodes comments to the expression on the RHS. The RHS is
|
|||||||
Similar to the plain form, however the RHS evaluates against each matching LHS node! This is useful if you want to set the comments as a relative expression of the node, for instance its value or path.
|
Similar to the plain form, however the RHS evaluates against each matching LHS node! This is useful if you want to set the comments as a relative expression of the node, for instance its value or path.
|
||||||
|
|
||||||
## Set line comment
|
## Set line comment
|
||||||
|
Set the comment on the key node for more reliability (see below).
|
||||||
|
|
||||||
Given a sample.yml file of:
|
Given a sample.yml file of:
|
||||||
```yaml
|
```yaml
|
||||||
a: cat
|
a: cat
|
||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.a lineComment="single"' sample.yml
|
yq '.a line_comment="single"' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
a: cat # single
|
a: cat # single
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Set line comment of a maps/arrays
|
||||||
|
For maps and arrays, you need to set the line comment on the _key_ node. This will also work for scalars.
|
||||||
|
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
a:
|
||||||
|
b: things
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq '(.a | key) line_comment="single"' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
a: # single
|
||||||
|
b: things
|
||||||
|
```
|
||||||
|
|
||||||
## Use update assign to perform relative updates
|
## Use update assign to perform relative updates
|
||||||
Given a sample.yml file of:
|
Given a sample.yml file of:
|
||||||
```yaml
|
```yaml
|
||||||
@@ -32,7 +52,7 @@ b: dog
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.. lineComment |= .' sample.yml
|
yq '.. line_comment |= .' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -40,6 +60,121 @@ a: cat # cat
|
|||||||
b: dog # dog
|
b: dog # dog
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Where is the comment - map key example
|
||||||
|
The underlying yaml parser can assign comments in a document to surprising nodes. Use an expression like this to find where you comment is. 'p' indicates the path, 'isKey' is if the node is a map key (as opposed to a map value).
|
||||||
|
From this, you can see the 'hello-world-comment' is actually on the 'hello' key
|
||||||
|
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
hello: # hello-world-comment
|
||||||
|
message: world
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq '[... | {"p": path | join("."), "isKey": is_key, "hc": headComment, "lc": lineComment, "fc": footComment}]' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
- p: ""
|
||||||
|
isKey: false
|
||||||
|
hc: ""
|
||||||
|
lc: ""
|
||||||
|
fc: ""
|
||||||
|
- p: hello
|
||||||
|
isKey: true
|
||||||
|
hc: ""
|
||||||
|
lc: hello-world-comment
|
||||||
|
fc: ""
|
||||||
|
- p: hello
|
||||||
|
isKey: false
|
||||||
|
hc: ""
|
||||||
|
lc: ""
|
||||||
|
fc: ""
|
||||||
|
- p: hello.message
|
||||||
|
isKey: true
|
||||||
|
hc: ""
|
||||||
|
lc: ""
|
||||||
|
fc: ""
|
||||||
|
- p: hello.message
|
||||||
|
isKey: false
|
||||||
|
hc: ""
|
||||||
|
lc: ""
|
||||||
|
fc: ""
|
||||||
|
```
|
||||||
|
|
||||||
|
## Retrieve comment - map key example
|
||||||
|
From the previous example, we know that the comment is on the 'hello' _key_ as a lineComment
|
||||||
|
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
hello: # hello-world-comment
|
||||||
|
message: world
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq '.hello | key | line_comment' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
hello-world-comment
|
||||||
|
```
|
||||||
|
|
||||||
|
## Where is the comment - array example
|
||||||
|
The underlying yaml parser can assign comments in a document to surprising nodes. Use an expression like this to find where you comment is. 'p' indicates the path, 'isKey' is if the node is a map key (as opposed to a map value).
|
||||||
|
From this, you can see the 'under-name-comment' is actually on the first child
|
||||||
|
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
name:
|
||||||
|
# under-name-comment
|
||||||
|
- first-array-child
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq '[... | {"p": path | join("."), "isKey": is_key, "hc": headComment, "lc": lineComment, "fc": footComment}]' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
- p: ""
|
||||||
|
isKey: false
|
||||||
|
hc: ""
|
||||||
|
lc: ""
|
||||||
|
fc: ""
|
||||||
|
- p: name
|
||||||
|
isKey: true
|
||||||
|
hc: ""
|
||||||
|
lc: ""
|
||||||
|
fc: ""
|
||||||
|
- p: name
|
||||||
|
isKey: false
|
||||||
|
hc: ""
|
||||||
|
lc: ""
|
||||||
|
fc: ""
|
||||||
|
- p: name.0
|
||||||
|
isKey: false
|
||||||
|
hc: under-name-comment
|
||||||
|
lc: ""
|
||||||
|
fc: ""
|
||||||
|
```
|
||||||
|
|
||||||
|
## Retrieve comment - array example
|
||||||
|
From the previous example, we know that the comment is on the first child as a headComment
|
||||||
|
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
name:
|
||||||
|
# under-name-comment
|
||||||
|
- first-array-child
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq '.name[0] | headComment' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
under-name-comment
|
||||||
|
```
|
||||||
|
|
||||||
## Set head comment
|
## Set head comment
|
||||||
Given a sample.yml file of:
|
Given a sample.yml file of:
|
||||||
```yaml
|
```yaml
|
||||||
@@ -47,7 +182,7 @@ a: cat
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '. headComment="single"' sample.yml
|
yq '. head_comment="single"' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -56,6 +191,25 @@ will output
|
|||||||
a: cat
|
a: cat
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Set head comment of a map entry
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
f: foo
|
||||||
|
a:
|
||||||
|
b: cat
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq '(.a | key) head_comment="single"' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
f: foo
|
||||||
|
# single
|
||||||
|
a:
|
||||||
|
b: cat
|
||||||
|
```
|
||||||
|
|
||||||
## Set foot comment, using an expression
|
## Set foot comment, using an expression
|
||||||
Given a sample.yml file of:
|
Given a sample.yml file of:
|
||||||
```yaml
|
```yaml
|
||||||
@@ -63,12 +217,11 @@ a: cat
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '. footComment=.a' sample.yml
|
yq '. foot_comment=.a' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
a: cat
|
a: cat
|
||||||
|
|
||||||
# cat
|
# cat
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -80,7 +233,7 @@ b: dog # leave this
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.a lineComment=""' sample.yml
|
yq '.a line_comment=""' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -93,13 +246,15 @@ Note the use of `...` to ensure key nodes are included.
|
|||||||
|
|
||||||
Given a sample.yml file of:
|
Given a sample.yml file of:
|
||||||
```yaml
|
```yaml
|
||||||
|
# hi
|
||||||
|
|
||||||
a: cat # comment
|
a: cat # comment
|
||||||
# great
|
# great
|
||||||
b: # key comment
|
b: # key comment
|
||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '... comments=""' sample.yml
|
yq '... comments=""' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -110,11 +265,14 @@ b:
|
|||||||
## Get line comment
|
## Get line comment
|
||||||
Given a sample.yml file of:
|
Given a sample.yml file of:
|
||||||
```yaml
|
```yaml
|
||||||
|
# welcome!
|
||||||
|
|
||||||
a: cat # meow
|
a: cat # meow
|
||||||
|
# have a great day
|
||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.a | lineComment' sample.yml
|
yq '.a | line_comment' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -132,11 +290,12 @@ a: cat # meow
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '. | headComment' sample.yml
|
yq '. | head_comment' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
welcome!
|
welcome!
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Head comment with document split
|
## Head comment with document split
|
||||||
@@ -151,7 +310,7 @@ a: cat # meow
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval 'headComment' sample.yml
|
yq 'head_comment' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -171,7 +330,7 @@ a: cat # meow
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '. | footComment' sample.yml
|
yq '. | foot_comment' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
|
|||||||
@@ -0,0 +1,100 @@
|
|||||||
|
# Compare Operators
|
||||||
|
|
||||||
|
Comparison operators (`>`, `>=`, `<`, `<=`) can be used for comparing scalar values of the same time.
|
||||||
|
|
||||||
|
The following types are currently supported:
|
||||||
|
|
||||||
|
- numbers
|
||||||
|
- strings
|
||||||
|
- datetimes
|
||||||
|
|
||||||
|
## Related Operators
|
||||||
|
|
||||||
|
- equals / not equals (`==`, `!=`) operators [here](https://mikefarah.gitbook.io/yq/operators/equals)
|
||||||
|
- boolean operators (`and`, `or`, `any` etc) [here](https://mikefarah.gitbook.io/yq/operators/boolean-operators)
|
||||||
|
- select operator [here](https://mikefarah.gitbook.io/yq/operators/select)
|
||||||
|
|
||||||
|
## Compare numbers (>)
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
a: 5
|
||||||
|
b: 4
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq '.a > .b' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
true
|
||||||
|
```
|
||||||
|
|
||||||
|
## Compare equal numbers (>=)
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
a: 5
|
||||||
|
b: 5
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq '.a >= .b' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
true
|
||||||
|
```
|
||||||
|
|
||||||
|
## Compare strings
|
||||||
|
Compares strings by their bytecode.
|
||||||
|
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
a: zoo
|
||||||
|
b: apple
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq '.a > .b' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
true
|
||||||
|
```
|
||||||
|
|
||||||
|
## Compare date times
|
||||||
|
You can compare date times. Assumes RFC3339 date time format, see [date-time operators](https://mikefarah.gitbook.io/yq/operators/date-time-operators) for more information.
|
||||||
|
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
a: 2021-01-01T03:10:00Z
|
||||||
|
b: 2020-01-01T03:10:00Z
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq '.a > .b' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
true
|
||||||
|
```
|
||||||
|
|
||||||
|
## Both sides are null: > is false
|
||||||
|
Running
|
||||||
|
```bash
|
||||||
|
yq --null-input '.a > .b'
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
false
|
||||||
|
```
|
||||||
|
|
||||||
|
## Both sides are null: >= is true
|
||||||
|
Running
|
||||||
|
```bash
|
||||||
|
yq --null-input '.a >= .b'
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
true
|
||||||
|
```
|
||||||
|
|
||||||
@@ -1,6 +1,14 @@
|
|||||||
# Contains
|
# Contains
|
||||||
|
|
||||||
This returns `true` if the context contains the passed in parameter, and false otherwise.
|
This returns `true` if the context contains the passed in parameter, and false otherwise. For arrays, this will return true if the passed in array is contained within the array. For strings, it will return true if the string is a substring.
|
||||||
|
|
||||||
|
{% hint style="warning" %}
|
||||||
|
|
||||||
|
_Note_ that, just like jq, when checking if an array of strings `contains` another, this will use `contains` and _not_ equals to check each string. This means an array like `contains(["cat"])` will return true for an array `["cats"]`.
|
||||||
|
|
||||||
|
See the "Array has a subset array" example below on how to check for a subset.
|
||||||
|
|
||||||
|
{% endhint %}
|
||||||
|
|
||||||
## Array contains array
|
## Array contains array
|
||||||
Array is equal or subset of
|
Array is equal or subset of
|
||||||
@@ -13,13 +21,31 @@ Given a sample.yml file of:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval 'contains(["baz", "bar"])' sample.yml
|
yq 'contains(["baz", "bar"])' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
true
|
true
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Array has a subset array
|
||||||
|
Subtract the superset array from the subset, if there's anything left, it's not a subset
|
||||||
|
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
- foobar
|
||||||
|
- foobaz
|
||||||
|
- blarp
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq '["baz", "bar"] - . | length == 0' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
false
|
||||||
|
```
|
||||||
|
|
||||||
## Object included in array
|
## Object included in array
|
||||||
Given a sample.yml file of:
|
Given a sample.yml file of:
|
||||||
```yaml
|
```yaml
|
||||||
@@ -32,7 +58,7 @@ Given a sample.yml file of:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval 'contains({"bar": [{"barp": 12}]})' sample.yml
|
yq 'contains({"bar": [{"barp": 12}]})' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -51,7 +77,7 @@ Given a sample.yml file of:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval 'contains({"foo": 12, "bar": [{"barp": 15}]})' sample.yml
|
yq 'contains({"foo": 12, "bar": [{"barp": 15}]})' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -65,7 +91,7 @@ foobar
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval 'contains("bar")' sample.yml
|
yq 'contains("bar")' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -79,7 +105,7 @@ meow
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval 'contains("meow")' sample.yml
|
yq 'contains("meow")' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ This is used to construct objects (or maps). This can be used against existing y
|
|||||||
## Collect empty object
|
## Collect empty object
|
||||||
Running
|
Running
|
||||||
```bash
|
```bash
|
||||||
yq eval --null-input '{}'
|
yq --null-input '{}'
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -19,7 +19,7 @@ name: Mike
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '{"wrap": .}' sample.yml
|
yq '{"wrap": .}' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -37,7 +37,7 @@ pets:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '{.name: .pets.[]}' sample.yml
|
yq '{.name: .pets.[]}' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -60,7 +60,7 @@ pets:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '{.name: .pets.[]}' sample.yml
|
yq '{.name: .pets.[]}' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -73,10 +73,23 @@ Rosey: sheep
|
|||||||
## Creating yaml from scratch
|
## Creating yaml from scratch
|
||||||
Running
|
Running
|
||||||
```bash
|
```bash
|
||||||
yq eval --null-input '{"wrap": "frog"}'
|
yq --null-input '{"wrap": "frog"}'
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
wrap: frog
|
wrap: frog
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Creating yaml from scratch with multiple objects
|
||||||
|
Running
|
||||||
|
```bash
|
||||||
|
yq --null-input '(.a.b = "foo") | (.d.e = "bar")'
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
a:
|
||||||
|
b: foo
|
||||||
|
d:
|
||||||
|
e: bar
|
||||||
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,221 @@
|
|||||||
|
# Date Time
|
||||||
|
|
||||||
|
Various operators for parsing and manipulating dates.
|
||||||
|
|
||||||
|
## Date time formattings
|
||||||
|
This uses the golangs built in time library for parsing and formatting date times.
|
||||||
|
|
||||||
|
When not specified, the RFC3339 standard is assumed `2006-01-02T15:04:05Z07:00` for parsing.
|
||||||
|
|
||||||
|
To specify a custom parsing format, use the `with_dtf` operator. The first parameter sets the datetime parsing format for the expression in the second parameter. The expression can be any valid `yq` expression tree.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yq 'with_dtf("myformat"; .a + "3h" | tz("Australia/Melbourne"))'
|
||||||
|
```
|
||||||
|
|
||||||
|
See the [library docs](https://pkg.go.dev/time#pkg-constants) for examples of formatting options.
|
||||||
|
|
||||||
|
|
||||||
|
## Timezones
|
||||||
|
This uses golangs built in LoadLocation function to parse timezones strings. See the [library docs](https://pkg.go.dev/time#LoadLocation) for more details.
|
||||||
|
|
||||||
|
|
||||||
|
## Durations
|
||||||
|
Durations are parsed using golangs built in [ParseDuration](https://pkg.go.dev/time#ParseDuration) function.
|
||||||
|
|
||||||
|
You can durations to time using the `+` operator.
|
||||||
|
|
||||||
|
## Format: from standard RFC3339 format
|
||||||
|
Providing a single parameter assumes a standard RFC3339 datetime format. If the target format is not a valid yaml datetime format, the result will be a string tagged node.
|
||||||
|
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
a: 2001-12-15T02:59:43.1Z
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq '.a |= format_datetime("Monday, 02-Jan-06 at 3:04PM")' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
a: Saturday, 15-Dec-01 at 2:59AM
|
||||||
|
```
|
||||||
|
|
||||||
|
## Format: from custom date time
|
||||||
|
Use with_dtf to set a custom datetime format for parsing.
|
||||||
|
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
a: Saturday, 15-Dec-01 at 2:59AM
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq '.a |= with_dtf("Monday, 02-Jan-06 at 3:04PM"; format_datetime("2006-01-02"))' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
a: 2001-12-15
|
||||||
|
```
|
||||||
|
|
||||||
|
## Format: get the day of the week
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
a: 2001-12-15
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq '.a | format_datetime("Monday")' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
Saturday
|
||||||
|
```
|
||||||
|
|
||||||
|
## Now
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
a: cool
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq '.updated = now' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
a: cool
|
||||||
|
updated: 2021-05-19T01:02:03Z
|
||||||
|
```
|
||||||
|
|
||||||
|
## From Unix
|
||||||
|
Converts from unix time. Note, you don't have to pipe through the tz operator :)
|
||||||
|
|
||||||
|
Running
|
||||||
|
```bash
|
||||||
|
yq --null-input '1675301929 | from_unix | tz("UTC")'
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
2023-02-02T01:38:49Z
|
||||||
|
```
|
||||||
|
|
||||||
|
## To Unix
|
||||||
|
Converts to unix time
|
||||||
|
|
||||||
|
Running
|
||||||
|
```bash
|
||||||
|
yq --null-input 'now | to_unix'
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
1621386123
|
||||||
|
```
|
||||||
|
|
||||||
|
## Timezone: from standard RFC3339 format
|
||||||
|
Returns a new datetime in the specified timezone. Specify standard IANA Time Zone format or 'utc', 'local'. When given a single parameter, this assumes the datetime is in RFC3339 format.
|
||||||
|
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
a: cool
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq '.updated = (now | tz("Australia/Sydney"))' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
a: cool
|
||||||
|
updated: 2021-05-19T11:02:03+10:00
|
||||||
|
```
|
||||||
|
|
||||||
|
## Timezone: with custom format
|
||||||
|
Specify standard IANA Time Zone format or 'utc', 'local'
|
||||||
|
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
a: Saturday, 15-Dec-01 at 2:59AM GMT
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq '.a |= with_dtf("Monday, 02-Jan-06 at 3:04PM MST"; tz("Australia/Sydney"))' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
a: Saturday, 15-Dec-01 at 1:59PM AEDT
|
||||||
|
```
|
||||||
|
|
||||||
|
## Add and tz custom format
|
||||||
|
Specify standard IANA Time Zone format or 'utc', 'local'
|
||||||
|
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
a: Saturday, 15-Dec-01 at 2:59AM GMT
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq '.a |= with_dtf("Monday, 02-Jan-06 at 3:04PM MST"; tz("Australia/Sydney"))' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
a: Saturday, 15-Dec-01 at 1:59PM AEDT
|
||||||
|
```
|
||||||
|
|
||||||
|
## Date addition
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
a: 2021-01-01T00:00:00Z
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq '.a += "3h10m"' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
a: 2021-01-01T03:10:00Z
|
||||||
|
```
|
||||||
|
|
||||||
|
## Date subtraction
|
||||||
|
You can subtract durations from dates. Assumes RFC3339 date time format, see [date-time operators](https://mikefarah.gitbook.io/yq/operators/datetime#date-time-formattings) for more information.
|
||||||
|
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
a: 2021-01-01T03:10:00Z
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq '.a -= "3h10m"' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
a: 2021-01-01T00:00:00Z
|
||||||
|
```
|
||||||
|
|
||||||
|
## Date addition - custom format
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
a: Saturday, 15-Dec-01 at 2:59AM GMT
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq 'with_dtf("Monday, 02-Jan-06 at 3:04PM MST"; .a += "3h1m")' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
a: Saturday, 15-Dec-01 at 6:00AM GMT
|
||||||
|
```
|
||||||
|
|
||||||
|
## Date script with custom format
|
||||||
|
You can embed full expressions in with_dtf if needed.
|
||||||
|
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
a: Saturday, 15-Dec-01 at 2:59AM GMT
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq 'with_dtf("Monday, 02-Jan-06 at 3:04PM MST"; .a = (.a + "3h1m" | tz("Australia/Perth")))' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
a: Saturday, 15-Dec-01 at 2:00PM AWST
|
||||||
|
```
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@ b: dog
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval 'del(.b)' sample.yml
|
yq 'del(.b)' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -26,7 +26,7 @@ a:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval 'del(.a.a1)' sample.yml
|
yq 'del(.a.a1)' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -43,7 +43,7 @@ Given a sample.yml file of:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval 'del(.[1])' sample.yml
|
yq 'del(.[1])' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -59,7 +59,7 @@ Given a sample.yml file of:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval 'del(.[0].a)' sample.yml
|
yq 'del(.[0].a)' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -74,7 +74,7 @@ b: dog
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval 'del(.c)' sample.yml
|
yq 'del(.c)' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -91,7 +91,7 @@ c: bat
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval 'del( .[] | select(. == "*at") )' sample.yml
|
yq 'del( .[] | select(. == "*at") )' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -109,7 +109,7 @@ a:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval 'del(.. | select(has("name")).name)' sample.yml
|
yq 'del(.. | select(has("name")).name)' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ a: frog
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.a | documentIndex' sample.yml
|
yq '.a | document_index' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -29,7 +29,7 @@ a: frog
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.a | di' sample.yml
|
yq '.a | di' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -47,7 +47,7 @@ a: frog
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval 'select(documentIndex == 1)' sample.yml
|
yq 'select(document_index == 1)' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -63,7 +63,7 @@ a: frog
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval 'select(di == 1)' sample.yml
|
yq 'select(di == 1)' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -79,7 +79,7 @@ a: frog
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.a | ({"match": ., "doc": documentIndex})' sample.yml
|
yq '.a | ({"match": ., "doc": document_index})' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
|
|||||||
@@ -4,24 +4,29 @@ Encode operators will take the piped in object structure and encode it as a stri
|
|||||||
|
|
||||||
Note that you can optionally pass an indent value to the encode functions (see below).
|
Note that you can optionally pass an indent value to the encode functions (see below).
|
||||||
|
|
||||||
These operators are useful to process yaml documents that have stringified embeded yaml/json/props in them.
|
These operators are useful to process yaml documents that have stringified embedded yaml/json/props in them.
|
||||||
|
|
||||||
|
|
||||||
| Format | Decode (from string) | Encode (to string) |
|
| Format | Decode (from string) | Encode (to string) |
|
||||||
| --- | -- | --|
|
| --- | -- | --|
|
||||||
| Yaml | from_yaml | to_yaml(i)/@yaml |
|
| Yaml | from_yaml/@yamld | to_yaml(i)/@yaml |
|
||||||
| JSON | from_json | to_json(i)/@json |
|
| JSON | from_json/@jsond | to_json(i)/@json |
|
||||||
| Properties | | to_props/@props |
|
| Properties | from_props/@propsd | to_props/@props |
|
||||||
| CSV | | to_csv/@csv |
|
| CSV | from_csv/@csvd | to_csv/@csv |
|
||||||
| TSV | | to_tsv/@tsv |
|
| TSV | from_tsv/@tsvd | to_tsv/@tsv |
|
||||||
| XML | from_xml | to_xml(i)/@xml |
|
| XML | from_xml/@xmld | to_xml(i)/@xml |
|
||||||
|
| Base64 | @base64d | @base64 |
|
||||||
|
| URI | @urid | @uri |
|
||||||
|
| Shell | | @sh |
|
||||||
|
|
||||||
|
|
||||||
CSV and TSV format both accept either a single array or scalars (representing a single row), or an array of array of scalars (representing multiple rows).
|
See CSV and TSV [documentation](https://mikefarah.gitbook.io/yq/usage/csv-tsv) for accepted formats.
|
||||||
|
|
||||||
XML uses the `--xml-attribute-prefix` and `xml-content-name` flags to identify attributes and content fields.
|
XML uses the `--xml-attribute-prefix` and `xml-content-name` flags to identify attributes and content fields.
|
||||||
|
|
||||||
|
|
||||||
|
Base64 assumes [rfc4648](https://rfc-editor.org/rfc/rfc4648.html) encoding. Encoding and decoding both assume that the content is a string.
|
||||||
|
|
||||||
## Encode value as json string
|
## Encode value as json string
|
||||||
Given a sample.yml file of:
|
Given a sample.yml file of:
|
||||||
```yaml
|
```yaml
|
||||||
@@ -30,7 +35,7 @@ a:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.b = (.a | to_json)' sample.yml
|
yq '.b = (.a | to_json)' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -52,7 +57,7 @@ a:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.b = (.a | to_json(0))' sample.yml
|
yq '.b = (.a | to_json(0))' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -71,7 +76,7 @@ a:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.b = (.a | @json)' sample.yml
|
yq '.b = (.a | @json)' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -89,7 +94,7 @@ a: '{"cool":"thing"}'
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.a | from_json | ... style=""' sample.yml
|
yq '.a | from_json | ... style=""' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -104,7 +109,7 @@ a:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.b = (.a | @props)' sample.yml
|
yq '.b = (.a | @props)' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -114,6 +119,60 @@ b: |
|
|||||||
cool = thing
|
cool = thing
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Decode props encoded string
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
a: |-
|
||||||
|
cats=great
|
||||||
|
dogs=cool as well
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq '.a |= @propsd' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
a:
|
||||||
|
cats: great
|
||||||
|
dogs: cool as well
|
||||||
|
```
|
||||||
|
|
||||||
|
## Decode csv encoded string
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
a: |-
|
||||||
|
cats,dogs
|
||||||
|
great,cool as well
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq '.a |= @csvd' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
a:
|
||||||
|
- cats: great
|
||||||
|
dogs: cool as well
|
||||||
|
```
|
||||||
|
|
||||||
|
## Decode tsv encoded string
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
a: |-
|
||||||
|
cats dogs
|
||||||
|
great cool as well
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq '.a |= @tsvd' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
a:
|
||||||
|
- cats: great
|
||||||
|
dogs: cool as well
|
||||||
|
```
|
||||||
|
|
||||||
## Encode value as yaml string
|
## Encode value as yaml string
|
||||||
Indent defaults to 2
|
Indent defaults to 2
|
||||||
|
|
||||||
@@ -125,7 +184,7 @@ a:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.b = (.a | to_yaml)' sample.yml
|
yq '.b = (.a | to_yaml)' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -148,7 +207,7 @@ a:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.b = (.a | to_yaml(8))' sample.yml
|
yq '.b = (.a | to_yaml(8))' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -167,7 +226,7 @@ a: 'foo: bar'
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.b = (.a | from_yaml)' sample.yml
|
yq '.b = (.a | from_yaml)' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -186,7 +245,7 @@ a: |
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.a |= (from_yaml | .foo = "cat" | to_yaml)' sample.yml
|
yq '.a |= (from_yaml | .foo = "cat" | to_yaml)' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -202,7 +261,7 @@ a: 'foo: bar'
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.a |= (from_yaml | .foo = "cat" | to_yaml)' sample.yml
|
yq '.a |= (from_yaml | .foo = "cat" | to_yaml)' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -221,7 +280,7 @@ Given a sample.yml file of:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '@csv' sample.yml
|
yq '@csv' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -242,7 +301,7 @@ Given a sample.yml file of:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '@csv' sample.yml
|
yq '@csv' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -266,7 +325,7 @@ Given a sample.yml file of:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '@tsv' sample.yml
|
yq '@tsv' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -280,11 +339,11 @@ Given a sample.yml file of:
|
|||||||
a:
|
a:
|
||||||
cool:
|
cool:
|
||||||
foo: bar
|
foo: bar
|
||||||
+id: hi
|
+@id: hi
|
||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.a | to_xml' sample.yml
|
yq '.a | to_xml' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -300,11 +359,11 @@ Given a sample.yml file of:
|
|||||||
a:
|
a:
|
||||||
cool:
|
cool:
|
||||||
foo: bar
|
foo: bar
|
||||||
+id: hi
|
+@id: hi
|
||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.a | @xml' sample.yml
|
yq '.a | @xml' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -318,11 +377,11 @@ Given a sample.yml file of:
|
|||||||
a:
|
a:
|
||||||
cool:
|
cool:
|
||||||
foo: bar
|
foo: bar
|
||||||
+id: hi
|
+@id: hi
|
||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '{"cat": .a | to_xml(1)}' sample.yml
|
yq '{"cat": .a | to_xml(1)}' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -339,7 +398,7 @@ a: <foo>bar</foo>
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.b = (.a | from_xml)' sample.yml
|
yq '.b = (.a | from_xml)' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -348,3 +407,110 @@ b:
|
|||||||
foo: bar
|
foo: bar
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Encode a string to base64
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
coolData: a special string
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq '.coolData | @base64' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
YSBzcGVjaWFsIHN0cmluZw==
|
||||||
|
```
|
||||||
|
|
||||||
|
## Encode a yaml document to base64
|
||||||
|
Pipe through @yaml first to convert to a string, then use @base64 to encode it.
|
||||||
|
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
a: apple
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq '@yaml | @base64' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
YTogYXBwbGUK
|
||||||
|
```
|
||||||
|
|
||||||
|
## Encode a string to uri
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
coolData: this has & special () characters *
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq '.coolData | @uri' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
this+has+%26+special+%28%29+characters+%2A
|
||||||
|
```
|
||||||
|
|
||||||
|
## Decode a URI to a string
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
this+has+%26+special+%28%29+characters+%2A
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq '@urid' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
this has & special () characters *
|
||||||
|
```
|
||||||
|
|
||||||
|
## Encode a string to sh
|
||||||
|
Sh/Bash friendly string
|
||||||
|
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
coolData: strings with spaces and a 'quote'
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq '.coolData | @sh' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
strings' with spaces and a '\'quote\'
|
||||||
|
```
|
||||||
|
|
||||||
|
## Decode a base64 encoded string
|
||||||
|
Decoded data is assumed to be a string.
|
||||||
|
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
coolData: V29ya3Mgd2l0aCBVVEYtMTYg8J+Yig==
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq '.coolData | @base64d' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
Works with UTF-16 😊
|
||||||
|
```
|
||||||
|
|
||||||
|
## Decode a base64 encoded yaml document
|
||||||
|
Pipe through `from_yaml` to parse the decoded base64 string as a yaml document.
|
||||||
|
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
coolData: YTogYXBwbGUK
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq '.coolData |= (@base64d | from_yaml)' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
coolData:
|
||||||
|
a: apple
|
||||||
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ b: 2
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval 'to_entries' sample.yml
|
yq 'to_entries' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -28,7 +28,7 @@ Given a sample.yml file of:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval 'to_entries' sample.yml
|
yq 'to_entries' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -45,7 +45,7 @@ null
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval 'to_entries' sample.yml
|
yq 'to_entries' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -59,7 +59,7 @@ b: 2
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval 'to_entries | from_entries' sample.yml
|
yq 'to_entries | from_entries' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -77,7 +77,7 @@ Given a sample.yml file of:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval 'to_entries | from_entries' sample.yml
|
yq 'to_entries | from_entries' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -93,7 +93,7 @@ b: 2
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval 'with_entries(.key |= "KEY_" + .)' sample.yml
|
yq 'with_entries(.key |= "KEY_" + .)' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -101,6 +101,26 @@ KEY_a: 1
|
|||||||
KEY_b: 2
|
KEY_b: 2
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Custom sort map keys
|
||||||
|
Use to_entries to convert to an array of key/value pairs, sort the array using sort/sort_by/etc, and convert it back.
|
||||||
|
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
a: 1
|
||||||
|
c: 3
|
||||||
|
b: 2
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq 'to_entries | sort_by(.key) | reverse | from_entries' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
c: 3
|
||||||
|
b: 2
|
||||||
|
a: 1
|
||||||
|
```
|
||||||
|
|
||||||
## Use with_entries to filter the map
|
## Use with_entries to filter the map
|
||||||
Given a sample.yml file of:
|
Given a sample.yml file of:
|
||||||
```yaml
|
```yaml
|
||||||
@@ -111,7 +131,7 @@ c:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval 'with_entries(select(.value | has("b")))' sample.yml
|
yq 'with_entries(select(.value | has("b")))' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
|
|||||||
@@ -1,11 +1,39 @@
|
|||||||
# Env Variable Operators
|
# Env Variable Operators
|
||||||
|
|
||||||
This operator is used to handle environment variables usage in path expressions. While environment variables can, of course, be passed in via your CLI with string interpolation, this often comes with complex quote escaping and can be tricky to write and read. Note that there are two forms, `env` which will parse the environment variable as a yaml (be it a map, array, string, number of boolean) and `strenv` which will always parse the argument as a string.
|
These operators are used to handle environment variables usage in expressions and documents. While environment variables can, of course, be passed in via your CLI with string interpolation, this often comes with complex quote escaping and can be tricky to write and read.
|
||||||
|
|
||||||
|
There are three operators:
|
||||||
|
|
||||||
|
- `env` which takes a single environment variable name and parse the variable as a yaml node (be it a map, array, string, number of boolean)
|
||||||
|
- `strenv` which also takes a single environment variable name, and always parses the variable as a string.
|
||||||
|
- `envsubst` which you pipe strings into and it interpolates environment variables in strings using [envsubst](https://github.com/a8m/envsubst).
|
||||||
|
|
||||||
|
|
||||||
|
## EnvSubst Options
|
||||||
|
You can optionally pass envsubst any of the following options:
|
||||||
|
|
||||||
|
- nu: NoUnset, this will fail if there are any referenced variables that are not set
|
||||||
|
- ne: NoEmpty, this will fail if there are any referenced variables that are empty
|
||||||
|
- ff: FailFast, this will abort on the first failure (rather than collect all the errors)
|
||||||
|
|
||||||
|
E.g:
|
||||||
|
`envsubst(ne, ff)` will fail on the first empty variable.
|
||||||
|
|
||||||
|
See [Imposing Restrictions](https://github.com/a8m/envsubst#imposing-restrictions) in the `envsubst` documentation for more information, and below for examples.
|
||||||
|
|
||||||
|
## Tip
|
||||||
|
To replace environment variables across all values in a document, `envsubst` can be used with the recursive descent operator
|
||||||
|
as follows:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yq '(.. | select(tag == "!!str")) |= envsubst' file.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
## Read string environment variable
|
## Read string environment variable
|
||||||
Running
|
Running
|
||||||
```bash
|
```bash
|
||||||
myenv="cat meow" yq eval --null-input '.a = env(myenv)'
|
myenv="cat meow" yq --null-input '.a = env(myenv)'
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -15,7 +43,7 @@ a: cat meow
|
|||||||
## Read boolean environment variable
|
## Read boolean environment variable
|
||||||
Running
|
Running
|
||||||
```bash
|
```bash
|
||||||
myenv="true" yq eval --null-input '.a = env(myenv)'
|
myenv="true" yq --null-input '.a = env(myenv)'
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -25,7 +53,7 @@ a: true
|
|||||||
## Read numeric environment variable
|
## Read numeric environment variable
|
||||||
Running
|
Running
|
||||||
```bash
|
```bash
|
||||||
myenv="12" yq eval --null-input '.a = env(myenv)'
|
myenv="12" yq --null-input '.a = env(myenv)'
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -35,7 +63,7 @@ a: 12
|
|||||||
## Read yaml environment variable
|
## Read yaml environment variable
|
||||||
Running
|
Running
|
||||||
```bash
|
```bash
|
||||||
myenv="{b: fish}" yq eval --null-input '.a = env(myenv)'
|
myenv="{b: fish}" yq --null-input '.a = env(myenv)'
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -45,7 +73,7 @@ a: {b: fish}
|
|||||||
## Read boolean environment variable as a string
|
## Read boolean environment variable as a string
|
||||||
Running
|
Running
|
||||||
```bash
|
```bash
|
||||||
myenv="true" yq eval --null-input '.a = strenv(myenv)'
|
myenv="true" yq --null-input '.a = strenv(myenv)'
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -55,13 +83,35 @@ a: "true"
|
|||||||
## Read numeric environment variable as a string
|
## Read numeric environment variable as a string
|
||||||
Running
|
Running
|
||||||
```bash
|
```bash
|
||||||
myenv="12" yq eval --null-input '.a = strenv(myenv)'
|
myenv="12" yq --null-input '.a = strenv(myenv)'
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
a: "12"
|
a: "12"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Dynamically update a path from an environment variable
|
||||||
|
The env variable can be any valid yq expression.
|
||||||
|
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
a:
|
||||||
|
b:
|
||||||
|
- name: dog
|
||||||
|
- name: cat
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
pathEnv=".a.b[0].name" valueEnv="moo" yq 'eval(strenv(pathEnv)) = strenv(valueEnv)' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
a:
|
||||||
|
b:
|
||||||
|
- name: moo
|
||||||
|
- name: cat
|
||||||
|
```
|
||||||
|
|
||||||
## Dynamic key lookup with environment variable
|
## Dynamic key lookup with environment variable
|
||||||
Given a sample.yml file of:
|
Given a sample.yml file of:
|
||||||
```yaml
|
```yaml
|
||||||
@@ -70,10 +120,137 @@ dog: woof
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
myenv="cat" yq eval '.[env(myenv)]' sample.yml
|
myenv="cat" yq '.[env(myenv)]' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
meow
|
meow
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Replace strings with envsubst
|
||||||
|
Running
|
||||||
|
```bash
|
||||||
|
myenv="cat" yq --null-input '"the ${myenv} meows" | envsubst'
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
the cat meows
|
||||||
|
```
|
||||||
|
|
||||||
|
## Replace strings with envsubst, missing variables
|
||||||
|
Running
|
||||||
|
```bash
|
||||||
|
yq --null-input '"the ${myenvnonexisting} meows" | envsubst'
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
the meows
|
||||||
|
```
|
||||||
|
|
||||||
|
## Replace strings with envsubst(nu), missing variables
|
||||||
|
(nu) not unset, will fail if there are unset (missing) variables
|
||||||
|
|
||||||
|
Running
|
||||||
|
```bash
|
||||||
|
yq --null-input '"the ${myenvnonexisting} meows" | envsubst(nu)'
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```bash
|
||||||
|
Error: variable ${myenvnonexisting} not set
|
||||||
|
```
|
||||||
|
|
||||||
|
## Replace strings with envsubst(ne), missing variables
|
||||||
|
(ne) not empty, only validates set variables
|
||||||
|
|
||||||
|
Running
|
||||||
|
```bash
|
||||||
|
yq --null-input '"the ${myenvnonexisting} meows" | envsubst(ne)'
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
the meows
|
||||||
|
```
|
||||||
|
|
||||||
|
## Replace strings with envsubst(ne), empty variable
|
||||||
|
(ne) not empty, will fail if a references variable is empty
|
||||||
|
|
||||||
|
Running
|
||||||
|
```bash
|
||||||
|
myenv="" yq --null-input '"the ${myenv} meows" | envsubst(ne)'
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```bash
|
||||||
|
Error: variable ${myenv} set but empty
|
||||||
|
```
|
||||||
|
|
||||||
|
## Replace strings with envsubst, missing variables with defaults
|
||||||
|
Running
|
||||||
|
```bash
|
||||||
|
yq --null-input '"the ${myenvnonexisting-dog} meows" | envsubst'
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
the dog meows
|
||||||
|
```
|
||||||
|
|
||||||
|
## Replace strings with envsubst(nu), missing variables with defaults
|
||||||
|
Having a default specified skips over the missing variable.
|
||||||
|
|
||||||
|
Running
|
||||||
|
```bash
|
||||||
|
yq --null-input '"the ${myenvnonexisting-dog} meows" | envsubst(nu)'
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
the dog meows
|
||||||
|
```
|
||||||
|
|
||||||
|
## Replace strings with envsubst(ne), missing variables with defaults
|
||||||
|
Fails, because the variable is explicitly set to blank.
|
||||||
|
|
||||||
|
Running
|
||||||
|
```bash
|
||||||
|
myEmptyEnv="" yq --null-input '"the ${myEmptyEnv-dog} meows" | envsubst(ne)'
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```bash
|
||||||
|
Error: variable ${myEmptyEnv} set but empty
|
||||||
|
```
|
||||||
|
|
||||||
|
## Replace string environment variable in document
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
v: ${myenv}
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
myenv="cat meow" yq '.v |= envsubst' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
v: cat meow
|
||||||
|
```
|
||||||
|
|
||||||
|
## (Default) Return all envsubst errors
|
||||||
|
By default, all errors are returned at once.
|
||||||
|
|
||||||
|
Running
|
||||||
|
```bash
|
||||||
|
yq --null-input '"the ${notThere} ${alsoNotThere}" | envsubst(nu)'
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```bash
|
||||||
|
Error: variable ${notThere} not set
|
||||||
|
variable ${alsoNotThere} not set
|
||||||
|
```
|
||||||
|
|
||||||
|
## Fail fast, return the first envsubst error (and abort)
|
||||||
|
Running
|
||||||
|
```bash
|
||||||
|
yq --null-input '"the ${notThere} ${alsoNotThere}" | envsubst(nu,ff)'
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```bash
|
||||||
|
Error: variable ${notThere} not set
|
||||||
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Equals
|
# Equals / Not Equals
|
||||||
|
|
||||||
This is a boolean operator that will return `true` if the LHS is equal to the RHS and `false` otherwise.
|
This is a boolean operator that will return `true` if the LHS is equal to the RHS and `false` otherwise.
|
||||||
|
|
||||||
@@ -12,6 +12,15 @@ It is most often used with the select operator to find particular nodes:
|
|||||||
select(.a == .b)
|
select(.a == .b)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The not equals `!=` operator returns `false` if the LHS is equal to the RHS.
|
||||||
|
|
||||||
|
## Related Operators
|
||||||
|
|
||||||
|
- comparison (`>=`, `<` etc) operators [here](https://mikefarah.gitbook.io/yq/operators/compare)
|
||||||
|
- boolean operators (`and`, `or`, `any` etc) [here](https://mikefarah.gitbook.io/yq/operators/boolean-operators)
|
||||||
|
- select operator [here](https://mikefarah.gitbook.io/yq/operators/select)
|
||||||
|
|
||||||
|
|
||||||
## Match string
|
## Match string
|
||||||
Given a sample.yml file of:
|
Given a sample.yml file of:
|
||||||
```yaml
|
```yaml
|
||||||
@@ -21,7 +30,7 @@ Given a sample.yml file of:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.[] | (. == "*at")' sample.yml
|
yq '.[] | (. == "*at")' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -39,7 +48,7 @@ Given a sample.yml file of:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.[] | (. != "*at")' sample.yml
|
yq '.[] | (. != "*at")' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -57,7 +66,7 @@ Given a sample.yml file of:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.[] | (. == 4)' sample.yml
|
yq '.[] | (. == 4)' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -66,7 +75,7 @@ true
|
|||||||
false
|
false
|
||||||
```
|
```
|
||||||
|
|
||||||
## Dont match number
|
## Don't match number
|
||||||
Given a sample.yml file of:
|
Given a sample.yml file of:
|
||||||
```yaml
|
```yaml
|
||||||
- 3
|
- 3
|
||||||
@@ -75,7 +84,7 @@ Given a sample.yml file of:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.[] | (. != 4)' sample.yml
|
yq '.[] | (. != 4)' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -87,21 +96,21 @@ true
|
|||||||
## Match nulls
|
## Match nulls
|
||||||
Running
|
Running
|
||||||
```bash
|
```bash
|
||||||
yq eval --null-input 'null == ~'
|
yq --null-input 'null == ~'
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
true
|
true
|
||||||
```
|
```
|
||||||
|
|
||||||
## Non exisitant key doesn't equal a value
|
## Non existent key doesn't equal a value
|
||||||
Given a sample.yml file of:
|
Given a sample.yml file of:
|
||||||
```yaml
|
```yaml
|
||||||
a: frog
|
a: frog
|
||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval 'select(.b != "thing")' sample.yml
|
yq 'select(.b != "thing")' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -115,7 +124,7 @@ a: frog
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval 'select(.b == .c)' sample.yml
|
yq 'select(.b == .c)' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
# Error
|
||||||
|
|
||||||
|
Use this operation to short-circuit expressions. Useful for validation.
|
||||||
|
|
||||||
|
## Validate a particular value
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
a: hello
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq 'select(.a == "howdy") or error(".a [" + .a + "] is not howdy!")' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```bash
|
||||||
|
Error: .a [hello] is not howdy!
|
||||||
|
```
|
||||||
|
|
||||||
|
## Validate the environment variable is a number - invalid
|
||||||
|
Running
|
||||||
|
```bash
|
||||||
|
numberOfCats="please" yq --null-input 'env(numberOfCats) | select(tag == "!!int") or error("numberOfCats is not a number :(")'
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```bash
|
||||||
|
Error: numberOfCats is not a number :(
|
||||||
|
```
|
||||||
|
|
||||||
|
## Validate the environment variable is a number - valid
|
||||||
|
`with` can be a convenient way of encapsulating validation.
|
||||||
|
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
name: Bob
|
||||||
|
favouriteAnimal: cat
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
numberOfCats="3" yq '
|
||||||
|
with(env(numberOfCats); select(tag == "!!int") or error("numberOfCats is not a number :(")) |
|
||||||
|
.numPets = env(numberOfCats)
|
||||||
|
' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
name: Bob
|
||||||
|
favouriteAnimal: cat
|
||||||
|
numPets: 3
|
||||||
|
```
|
||||||
|
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
# Eval
|
||||||
|
|
||||||
|
Use `eval` to dynamically process an expression - for instance from an environment variable.
|
||||||
|
|
||||||
|
`eval` takes a single argument, and evaluates that as a `yq` expression. Any valid expression can be used, beit a path `.a.b.c | select(. == "cat")`, or an update `.a.b.c = "gogo"`.
|
||||||
|
|
||||||
|
Tip: This can be useful way parameterise complex scripts.
|
||||||
|
|
||||||
|
## Dynamically evaluate a path
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
pathExp: .a.b[] | select(.name == "cat")
|
||||||
|
a:
|
||||||
|
b:
|
||||||
|
- name: dog
|
||||||
|
- name: cat
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq 'eval(.pathExp)' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
name: cat
|
||||||
|
```
|
||||||
|
|
||||||
|
## Dynamically update a path from an environment variable
|
||||||
|
The env variable can be any valid yq expression.
|
||||||
|
|
||||||
|
Given a sample.yml file of:
|
||||||
|
```yaml
|
||||||
|
a:
|
||||||
|
b:
|
||||||
|
- name: dog
|
||||||
|
- name: cat
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
pathEnv=".a.b[0].name" valueEnv="moo" yq 'eval(strenv(pathEnv)) = strenv(valueEnv)' sample.yml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
a:
|
||||||
|
b:
|
||||||
|
- name: moo
|
||||||
|
- name: cat
|
||||||
|
```
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ a: cat
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval 'filename' sample.yml
|
yq 'filename' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -31,7 +31,7 @@ a: cat
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval 'fileIndex' sample.yml
|
yq 'file_index' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -49,7 +49,7 @@ a: cat
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval-all 'fileIndex' sample.yml another.yml
|
yq eval-all 'file_index' sample.yml another.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -65,7 +65,7 @@ a: cat
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval 'fi' sample.yml
|
yq 'fi' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ Given a sample.yml file of:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval 'flatten' sample.yml
|
yq 'flatten' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -30,7 +30,7 @@ Given a sample.yml file of:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval 'flatten(1)' sample.yml
|
yq 'flatten(1)' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -46,7 +46,7 @@ Given a sample.yml file of:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval 'flatten' sample.yml
|
yq 'flatten' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -61,7 +61,7 @@ Given a sample.yml file of:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval 'flatten' sample.yml
|
yq 'flatten' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ Given a sample.yml file of:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval 'group_by(.foo)' sample.yml
|
yq 'group_by(.foo)' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -40,7 +40,7 @@ Given a sample.yml file of:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval 'group_by(.foo)' sample.yml
|
yq 'group_by(.foo)' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ Given a sample.yml file of:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.[] | has("a")' sample.yml
|
yq '.[] | has("a")' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -36,7 +36,7 @@ Given a sample.yml file of:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.[] | select(.a.b | has("c"))' sample.yml
|
yq '.[] | select(.a.b | has("c"))' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
@@ -57,7 +57,7 @@ Given a sample.yml file of:
|
|||||||
```
|
```
|
||||||
then
|
then
|
||||||
```bash
|
```bash
|
||||||
yq eval '.[] | has(1)' sample.yml
|
yq '.[] | has(1)' sample.yml
|
||||||
```
|
```
|
||||||
will output
|
will output
|
||||||
```yaml
|
```yaml
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
yq [eval/eval-all] [expression] files..
|
yq [eval/eval-all] [expression] files..
|
||||||
|
|
||||||
eval/e - Apply the expression to each document in each yaml file in sequence
|
eval/e - (default) Apply the expression to each document in each yaml file in sequence
|
||||||
|
|
||||||
eval-all/ea - Loads all yaml documents of all yaml files and runs expression once
|
eval-all/ea - Loads all yaml documents of all yaml files and runs expression once
|
||||||
|
|
||||||
@@ -18,32 +18,33 @@ This documentation is also available at https://mikefarah.gitbook.io/yq/
|
|||||||
|
|
||||||
## Read a value:
|
## Read a value:
|
||||||
```bash
|
```bash
|
||||||
yq e '.a.b[0].c' file.yaml
|
yq '.a.b[0].c' file.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
## Pipe from STDIN:
|
## Pipe from STDIN:
|
||||||
```bash
|
```bash
|
||||||
cat file.yaml | yq e '.a.b[0].c' -
|
cat file.yaml | yq '.a.b[0].c'
|
||||||
```
|
```
|
||||||
|
|
||||||
## Update a yaml file, inplace
|
## Update a yaml file, inplace
|
||||||
```bash
|
```bash
|
||||||
yq e -i '.a.b[0].c = "cool"' file.yaml
|
yq -i '.a.b[0].c = "cool"' file.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
## Update using environment variables
|
## Update using environment variables
|
||||||
```bash
|
```bash
|
||||||
NAME=mike yq e -i '.a.b[0].c = strenv(NAME)' file.yaml
|
NAME=mike yq -i '.a.b[0].c = strenv(NAME)' file.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
## Merge multiple files
|
## Merge multiple files
|
||||||
```
|
```
|
||||||
yq ea '. as $item ireduce ({}; . * $item )' path/to/*.yml
|
yq ea '. as $item ireduce ({}; . * $item )' path/to/*.yml
|
||||||
```
|
```
|
||||||
|
Note the use of `ea` to evaluate all files at once (instead of in sequence.)
|
||||||
|
|
||||||
## Multiple updates to a yaml file
|
## Multiple updates to a yaml file
|
||||||
```bash
|
```bash
|
||||||
yq e -i '
|
yq -i '
|
||||||
.a.b[0].c = "cool" |
|
.a.b[0].c = "cool" |
|
||||||
.x.y.z = "foobar" |
|
.x.y.z = "foobar" |
|
||||||
.person.name = strenv(NAME)
|
.person.name = strenv(NAME)
|
||||||
|
|||||||
@@ -4,5 +4,7 @@ Add behaves differently according to the type of the LHS:
|
|||||||
* arrays: concatenate
|
* arrays: concatenate
|
||||||
* number scalars: arithmetic addition
|
* number scalars: arithmetic addition
|
||||||
* string scalars: concatenate
|
* string scalars: concatenate
|
||||||
|
* maps: shallow merge (use the multiply operator (`*`) to deeply merge)
|
||||||
|
|
||||||
|
Use `+=` as a relative append assign for things like increment. Note that `.a += .x` is equivalent to running `.a = .a + .x`.
|
||||||
|
|
||||||
Use `+=` as append assign for things like increment. Note that `.a += .x` is equivalent to running `.a = .a + .x`.
|
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
# Array to Map
|
||||||
|
|
||||||
|
Use this operator to convert an array to..a map. The indices are used as map keys, null values in the array are skipped over.
|
||||||
|
|
||||||
|
Behind the scenes, this is implemented using reduce:
|
||||||
|
|
||||||
|
```
|
||||||
|
(.[] | select(. != null) ) as $i ireduce({}; .[$i | key] = $i)
|
||||||
|
```
|
||||||
@@ -6,4 +6,8 @@ This operator is used to update node values. It can be used in either the:
|
|||||||
Which will assign the LHS node values to the RHS node values. The RHS expression is run against the matching nodes in the pipeline.
|
Which will assign the LHS node values to the RHS node values. The RHS expression is run against the matching nodes in the pipeline.
|
||||||
|
|
||||||
### relative form: `|=`
|
### relative form: `|=`
|
||||||
This will do a similar thing to the plain form, however, the RHS expression is run against _the LHS nodes_. This is useful for updating values based on old values, e.g. increment.
|
This will do a similar thing to the plain form, however, the RHS expression is run against _the LHS nodes_. This is useful for updating values based on old values, e.g. increment.
|
||||||
|
|
||||||
|
|
||||||
|
### Flags
|
||||||
|
- `c` clobber custom tags
|
||||||
|
|||||||
@@ -9,3 +9,9 @@ The `or` and `and` operators take two parameters and return a boolean result.
|
|||||||
`any_c(condition)` and `all_c(condition)` are like `any` and `all` but they take a condition expression that is used against each element to determine if it's `true`. Note: in `jq` you can simply pass a condition to `any` or `all` and it simply works - `yq` isn't that clever..yet
|
`any_c(condition)` and `all_c(condition)` are like `any` and `all` but they take a condition expression that is used against each element to determine if it's `true`. Note: in `jq` you can simply pass a condition to `any` or `all` and it simply works - `yq` isn't that clever..yet
|
||||||
|
|
||||||
These are most commonly used with the `select` operator to filter particular nodes.
|
These are most commonly used with the `select` operator to filter particular nodes.
|
||||||
|
|
||||||
|
## Related Operators
|
||||||
|
|
||||||
|
- equals / not equals (`==`, `!=`) operators [here](https://mikefarah.gitbook.io/yq/operators/equals)
|
||||||
|
- comparison (`>=`, `<` etc) operators [here](https://mikefarah.gitbook.io/yq/operators/compare)
|
||||||
|
- select operator [here](https://mikefarah.gitbook.io/yq/operators/select)
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# Column
|
||||||
|
|
||||||
|
Returns the column of the matching node. Starts from 1, 0 indicates there was no column data.
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
# Comment Operators
|
# Comment Operators
|
||||||
|
|
||||||
Use these comment operators to set or retrieve comments.
|
Use these comment operators to set or retrieve comments. Note that line comments on maps/arrays are actually set on the _key_ node as opposed to the _value_ (map/array). See below for examples.
|
||||||
|
|
||||||
Like the `=` and `|=` assign operators, the same syntax applies when updating comments:
|
Like the `=` and `|=` assign operators, the same syntax applies when updating comments:
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user