mirror of
https://github.com/taigrr/yq
synced 2025-01-18 04:53:17 -08:00
Compare commits
247 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b8b2c9de61 | ||
|
|
f5fdf98c38 | ||
|
|
29986db8f8 | ||
|
|
1f4e3a9cde | ||
|
|
b6da773dde | ||
|
|
8020d4253b | ||
|
|
3c701fe98e | ||
|
|
97d1aa2b26 | ||
|
|
d05391e244 | ||
|
|
d1cec1ad18 | ||
|
|
fe5842e5f9 | ||
|
|
e0d8cd6bf6 | ||
|
|
8f5ffe47ff | ||
|
|
5acc1e661e | ||
|
|
a9c0ef571c | ||
|
|
7a28531f2f | ||
|
|
5de2bea1b4 | ||
|
|
7320b8d3c9 | ||
|
|
2f70e6f27a | ||
|
|
a9e871ee00 | ||
|
|
bc4bab9380 | ||
|
|
665d9079fa | ||
|
|
7b54a44fcf | ||
|
|
94148e4398 | ||
|
|
f8553162ca | ||
|
|
be532bf2fe | ||
|
|
e9b8265ca3 | ||
|
|
0f8b864321 | ||
|
|
e5bcfedbe9 | ||
|
|
a5f5fb2562 | ||
|
|
84de9c078d | ||
|
|
c7f5261036 | ||
|
|
6e35356a84 | ||
|
|
b2fe3e6738 | ||
|
|
774badfef4 | ||
|
|
c4e9516aa6 | ||
|
|
323089eb64 | ||
|
|
53289366a5 | ||
|
|
cda9a82906 | ||
|
|
2dbde6b9fb | ||
|
|
f8c1c3c1b4 | ||
|
|
238a1241d2 | ||
|
|
8a61ef072a | ||
|
|
4f178d2317 | ||
|
|
133e55105c | ||
|
|
5e5468af3b | ||
|
|
9b4972e46e | ||
|
|
23543ee031 | ||
|
|
75c7d40c44 | ||
|
|
44b8a5e80f | ||
|
|
77c8f22a79 | ||
|
|
386a0ca3c3 | ||
|
|
53a20d4421 | ||
|
|
478208b7c4 | ||
|
|
1159d0a212 | ||
|
|
8861b392a8 | ||
|
|
16bde80334 | ||
|
|
8a3fb32f36 | ||
|
|
48dcc15281 | ||
|
|
d7040e3933 | ||
|
|
ef579d4ccf | ||
|
|
785ee68a76 | ||
|
|
90fe9c6512 | ||
|
|
a9ade5a832 | ||
|
|
8d6e3a6a75 | ||
|
|
7a6689eb40 | ||
|
|
e6660e2460 | ||
|
|
28169b04f7 | ||
|
|
742cf748ac | ||
|
|
54c06cdb4c | ||
|
|
ef5f745da3 | ||
|
|
25025f2771 | ||
|
|
ebb8b34b31 | ||
|
|
9a5e4ee828 | ||
|
|
0a2dd29940 | ||
|
|
50dfce86c9 | ||
|
|
e55006e935 | ||
|
|
d8fed62f03 | ||
|
|
52a39bf31e | ||
|
|
d84254c30f | ||
|
|
18bb4eee96 | ||
|
|
86b9fe3ef9 | ||
|
|
2c15048ddb | ||
|
|
ce2ee42f71 | ||
|
|
c2c49dcb17 | ||
|
|
60de18391c | ||
|
|
c86f8b426b | ||
|
|
b3532e0a61 | ||
|
|
b3b60665e4 | ||
|
|
df08b055cf | ||
|
|
e822313e82 | ||
|
|
a9f25c9d76 | ||
|
|
0a8c268dcc | ||
|
|
a0e70279a8 | ||
|
|
25c9c22d8d | ||
|
|
d46d555b07 | ||
|
|
fb87f638f2 | ||
|
|
facc81d1f4 | ||
|
|
c1f9065c68 | ||
|
|
be84cc3082 | ||
|
|
a2571da1a1 | ||
|
|
6d6e476ac8 | ||
|
|
ae0c042ae6 | ||
|
|
867ec92d3a | ||
|
|
113586b5e0 | ||
|
|
c38f19e0a9 | ||
|
|
8ca85b1c64 | ||
|
|
08870f8ec9 | ||
|
|
94b217984c | ||
|
|
2f5a481cc3 | ||
|
|
1a4064429d | ||
|
|
1b22e1d812 | ||
|
|
297522cbdd | ||
|
|
be991fdacd | ||
|
|
be08214773 | ||
|
|
9e971ebeae | ||
|
|
f340db5795 | ||
|
|
ab852ceafa | ||
|
|
06a843e9b2 | ||
|
|
ebdc092688 | ||
|
|
27089d1ca1 | ||
|
|
1853585d22 | ||
|
|
0124d26086 | ||
|
|
0d68bea3dc | ||
|
|
54603b3607 | ||
|
|
c86aeca325 | ||
|
|
a4f124f24f | ||
|
|
090b377fa5 | ||
|
|
3a4d62d820 | ||
|
|
6053c8c136 | ||
|
|
c5a45ba7d5 | ||
|
|
56a0771cd1 | ||
|
|
8072e66d46 | ||
|
|
26153b3eb5 | ||
|
|
f2e10f21c7 | ||
|
|
d3ecf7aa88 | ||
|
|
ee8ffd458a | ||
|
|
8f15dba812 | ||
|
|
92ce195424 | ||
|
|
e725a2cec5 | ||
|
|
37de7a3505 | ||
|
|
e96794a420 | ||
|
|
120ef8e4dc | ||
|
|
db1954da25 | ||
|
|
e552dbb6ab | ||
|
|
298126864f | ||
|
|
d30cd8cc75 | ||
|
|
e6ee86930b | ||
|
|
0ea3c71df7 | ||
|
|
ef99bedf45 | ||
|
|
6e1a5aef2c | ||
|
|
70bd860287 | ||
|
|
0abda0098c | ||
|
|
a409a7e82b | ||
|
|
0e4f9e8579 | ||
|
|
0c932ba7dc | ||
|
|
cb48ba7173 | ||
|
|
dc4f8a6adb | ||
|
|
1f6d7a50b2 | ||
|
|
6fc3bdf58f | ||
|
|
87b33e8603 | ||
|
|
cc7eb84388 | ||
|
|
9e3f8ebd0a | ||
|
|
28bcbd321f | ||
|
|
9dd4503b23 | ||
|
|
185d1faadb | ||
|
|
7b004cb456 | ||
|
|
54c73eb34f | ||
|
|
3b03a0852a | ||
|
|
a00e6c5316 | ||
|
|
9d1a5b17b8 | ||
|
|
c5f80a105d | ||
|
|
c17f8df8f8 | ||
|
|
66c8390d54 | ||
|
|
dda9b1f087 | ||
|
|
683de28c64 | ||
|
|
51fa1a87b7 | ||
|
|
b9ac6a3d9d | ||
|
|
499974c27e | ||
|
|
72bd88cfa5 | ||
|
|
6980be3800 | ||
|
|
2933ea1684 | ||
|
|
cf2f23d747 | ||
|
|
45e9ad870f | ||
|
|
53b2c64747 | ||
|
|
359ca5a117 | ||
|
|
79baa49eaa | ||
|
|
2cda78ce0b | ||
|
|
6d1e61c410 | ||
|
|
86639acf70 | ||
|
|
3beee3f804 | ||
|
|
1ed8e7017e | ||
|
|
5514d2300b | ||
|
|
5bb0934710 | ||
|
|
cdd78af4bc | ||
|
|
d07e436065 | ||
|
|
b2a0964de2 | ||
|
|
69e6bb354d | ||
|
|
ec25886528 | ||
|
|
c2000a446b | ||
|
|
08ba0083be | ||
|
|
909b62be54 | ||
|
|
0facf35d60 | ||
|
|
a7c4813703 | ||
|
|
373e0a5eb7 | ||
|
|
124c57f9d9 | ||
|
|
fb73a793bd | ||
|
|
c22394b540 | ||
|
|
b1ff47022b | ||
|
|
82f1230db8 | ||
|
|
a3190f1504 | ||
|
|
44ee869e47 | ||
|
|
5d2d37a5f8 | ||
|
|
e3fc944709 | ||
|
|
6ee9db9a70 | ||
|
|
0d75edfb67 | ||
|
|
037314af8a | ||
|
|
2a283b4ef7 | ||
|
|
7ef556f22b | ||
|
|
6b566fd983 | ||
|
|
001925a4d4 | ||
|
|
3dee7b89d2 | ||
|
|
c955815aab | ||
|
|
3720bf8211 | ||
|
|
5f09aabf4c | ||
|
|
98751cf607 | ||
|
|
2ec3b59da2 | ||
|
|
56c923228d | ||
|
|
c122b9a843 | ||
|
|
15f51d4bf0 | ||
|
|
219105f999 | ||
|
|
955ecc2547 | ||
|
|
1d5fbd5ad0 | ||
|
|
1605938c2c | ||
|
|
2780903b60 | ||
|
|
81672d4efe | ||
|
|
6a696c81db | ||
|
|
805729e4f7 | ||
|
|
7db31006da | ||
|
|
8409be1cdf | ||
|
|
c03c4813d4 | ||
|
|
5ee6a9b9ca | ||
|
|
8efc46deae | ||
|
|
e4d5769f29 | ||
|
|
fea6e0db3d | ||
|
|
6823d43325 | ||
|
|
da4b1a6449 |
1
.dockerignore
Normal file
1
.dockerignore
Normal file
@@ -0,0 +1 @@
|
|||||||
|
bin
|
||||||
14
.gitignore
vendored
14
.gitignore
vendored
@@ -6,7 +6,9 @@
|
|||||||
# Folders
|
# Folders
|
||||||
_obj
|
_obj
|
||||||
_test
|
_test
|
||||||
|
bin
|
||||||
build
|
build
|
||||||
|
build-done
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
# Architecture specific extensions/prefixes
|
# Architecture specific extensions/prefixes
|
||||||
@@ -20,8 +22,18 @@ _cgo_gotypes.go
|
|||||||
_cgo_export.*
|
_cgo_export.*
|
||||||
|
|
||||||
_testmain.go
|
_testmain.go
|
||||||
|
coverage.out
|
||||||
*.exe
|
*.exe
|
||||||
*.test
|
*.test
|
||||||
*.prof
|
*.prof
|
||||||
yaml
|
yaml
|
||||||
|
vendor/
|
||||||
|
tmp/
|
||||||
|
cover/
|
||||||
|
yq
|
||||||
|
|
||||||
|
# snapcraft
|
||||||
|
parts/
|
||||||
|
prime/
|
||||||
|
.snapcraft/
|
||||||
|
yq*.snap
|
||||||
|
|||||||
6
.travis.yml
Normal file
6
.travis.yml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
language: go
|
||||||
|
go:
|
||||||
|
- 1.13.x
|
||||||
|
script:
|
||||||
|
- scripts/devtools.sh
|
||||||
|
- make local build
|
||||||
23
Dockerfile
Normal file
23
Dockerfile
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
FROM golang:1.13 as builder
|
||||||
|
|
||||||
|
WORKDIR /go/src/mikefarah/yq
|
||||||
|
|
||||||
|
# cache devtools
|
||||||
|
COPY ./scripts/devtools.sh /go/src/mikefarah/yq/scripts/devtools.sh
|
||||||
|
RUN ./scripts/devtools.sh
|
||||||
|
|
||||||
|
COPY . /go/src/mikefarah/yq
|
||||||
|
|
||||||
|
RUN CGO_ENABLED=0 make local build
|
||||||
|
|
||||||
|
# Choose alpine as a base image to make this useful for CI, as many
|
||||||
|
# CI tools expect an interactive shell inside the container
|
||||||
|
FROM alpine:3.8 as production
|
||||||
|
|
||||||
|
COPY --from=builder /go/src/mikefarah/yq/yq /usr/bin/yq
|
||||||
|
RUN chmod +x /usr/bin/yq
|
||||||
|
|
||||||
|
ARG VERSION=none
|
||||||
|
LABEL version=${VERSION}
|
||||||
|
|
||||||
|
WORKDIR /workdir
|
||||||
30
Dockerfile.dev
Normal file
30
Dockerfile.dev
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
FROM golang:1.13
|
||||||
|
|
||||||
|
COPY scripts/devtools.sh /opt/devtools.sh
|
||||||
|
|
||||||
|
RUN set -e -x \
|
||||||
|
&& /opt/devtools.sh
|
||||||
|
|
||||||
|
# install mkdocs
|
||||||
|
RUN set -ex \
|
||||||
|
&& buildDeps=' \
|
||||||
|
build-essential \
|
||||||
|
python-dev \
|
||||||
|
' \
|
||||||
|
&& apt-get update && apt-get install -y --no-install-recommends \
|
||||||
|
$buildDeps \
|
||||||
|
python2.7 \
|
||||||
|
python-setuptools \
|
||||||
|
python-wheel \
|
||||||
|
python-pip \
|
||||||
|
&& pip install --upgrade \
|
||||||
|
pip \
|
||||||
|
'Markdown>=2.6.9' \
|
||||||
|
'mkdocs>=0.16.3' \
|
||||||
|
'mkdocs-material>=1.10.1' \
|
||||||
|
'markdown-include>=0.5.1' \
|
||||||
|
&& apt-get purge -y --auto-remove $buildDeps \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
ENV CGO_ENABLED 0
|
||||||
|
ENV GOPATH /go:/yq
|
||||||
19
LICENSE
Normal file
19
LICENSE
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
Copyright (c) 2017 Mike Farah
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
114
Makefile
Normal file
114
Makefile
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
MAKEFLAGS += --warn-undefined-variables
|
||||||
|
SHELL := /bin/bash
|
||||||
|
.SHELLFLAGS := -o pipefail -euc
|
||||||
|
.DEFAULT_GOAL := install
|
||||||
|
|
||||||
|
include Makefile.variables
|
||||||
|
|
||||||
|
.PHONY: help
|
||||||
|
help:
|
||||||
|
@echo 'Management commands for cicdtest:'
|
||||||
|
@echo
|
||||||
|
@echo 'Usage:'
|
||||||
|
@echo ' ## Develop / Test Commands'
|
||||||
|
@echo ' make build Build yq binary.'
|
||||||
|
@echo ' make install Install yq.'
|
||||||
|
@echo ' make xcompile Build cross-compiled binaries of yq.'
|
||||||
|
@echo ' make vendor Install dependencies to vendor directory.'
|
||||||
|
@echo ' make format Run code formatter.'
|
||||||
|
@echo ' make check Run static code analysis (lint).'
|
||||||
|
@echo ' make test Run tests on project.'
|
||||||
|
@echo ' make cover Run tests and capture code coverage metrics on project.'
|
||||||
|
@echo ' make clean Clean the directory tree of produced artifacts.'
|
||||||
|
@echo
|
||||||
|
@echo ' ## Utility Commands'
|
||||||
|
@echo ' make setup Configures Minishfit/Docker directory mounts.'
|
||||||
|
@echo
|
||||||
|
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
|
clean:
|
||||||
|
@rm -rf bin build cover *.out
|
||||||
|
|
||||||
|
## prefix before other make targets to run in your local dev environment
|
||||||
|
local: | quiet
|
||||||
|
@$(eval DOCKRUN= )
|
||||||
|
@mkdir -p tmp
|
||||||
|
@touch tmp/dev_image_id
|
||||||
|
quiet: # this is silly but shuts up 'Nothing to be done for `local`'
|
||||||
|
@:
|
||||||
|
|
||||||
|
prepare: tmp/dev_image_id
|
||||||
|
tmp/dev_image_id: Dockerfile.dev scripts/devtools.sh
|
||||||
|
@mkdir -p tmp
|
||||||
|
@docker rmi -f ${DEV_IMAGE} > /dev/null 2>&1 || true
|
||||||
|
@docker build -t ${DEV_IMAGE} -f Dockerfile.dev .
|
||||||
|
@docker inspect -f "{{ .ID }}" ${DEV_IMAGE} > tmp/dev_image_id
|
||||||
|
|
||||||
|
# ----------------------------------------------
|
||||||
|
# build
|
||||||
|
.PHONY: build
|
||||||
|
build: build/dev
|
||||||
|
|
||||||
|
.PHONY: build/dev
|
||||||
|
build/dev: test *.go
|
||||||
|
@mkdir -p bin/
|
||||||
|
${DOCKRUN} go build --ldflags "$(LDFLAGS)"
|
||||||
|
${DOCKRUN} bash ./scripts/acceptance.sh
|
||||||
|
|
||||||
|
## Compile the project for multiple OS and Architectures.
|
||||||
|
xcompile: check
|
||||||
|
@rm -rf build/
|
||||||
|
@mkdir -p build
|
||||||
|
${DOCKRUN} bash ./scripts/xcompile.sh
|
||||||
|
@find build -type d -exec chmod 755 {} \; || :
|
||||||
|
@find build -type f -exec chmod 755 {} \; || :
|
||||||
|
|
||||||
|
.PHONY: install
|
||||||
|
install: build
|
||||||
|
${DOCKRUN} go install
|
||||||
|
|
||||||
|
# Each of the fetch should be an entry within vendor.json; not currently included within project
|
||||||
|
.PHONY: vendor
|
||||||
|
vendor: tmp/dev_image_id
|
||||||
|
${DOCKRUN} go mod vendor
|
||||||
|
|
||||||
|
# ----------------------------------------------
|
||||||
|
# develop and test
|
||||||
|
|
||||||
|
.PHONY: format
|
||||||
|
format: vendor
|
||||||
|
${DOCKRUN} bash ./scripts/format.sh
|
||||||
|
|
||||||
|
.PHONY: check
|
||||||
|
check: format
|
||||||
|
${DOCKRUN} bash ./scripts/check.sh
|
||||||
|
|
||||||
|
.PHONY: test
|
||||||
|
test: check
|
||||||
|
${DOCKRUN} bash ./scripts/test.sh
|
||||||
|
|
||||||
|
.PHONY: cover
|
||||||
|
cover: check
|
||||||
|
@rm -rf cover/
|
||||||
|
@mkdir -p cover
|
||||||
|
${DOCKRUN} bash ./scripts/coverage.sh
|
||||||
|
@find cover -type d -exec chmod 755 {} \; || :
|
||||||
|
@find cover -type f -exec chmod 644 {} \; || :
|
||||||
|
|
||||||
|
.PHONY: build-docs
|
||||||
|
build-docs: prepare mkdocs.yml mkdocs/*
|
||||||
|
${DOCKRUN} mkdocs build
|
||||||
|
@find docs -type d -exec chmod 755 {} \; || :
|
||||||
|
@find docs -type f -exec chmod 644 {} \; || :
|
||||||
|
|
||||||
|
.PHONY: release
|
||||||
|
release: xcompile
|
||||||
|
${DOCKRUN} bash ./scripts/publish.sh
|
||||||
|
|
||||||
|
# ----------------------------------------------
|
||||||
|
# utilities
|
||||||
|
|
||||||
|
.PHONY: setup
|
||||||
|
setup:
|
||||||
|
@bash ./scripts/setup.sh
|
||||||
38
Makefile.variables
Normal file
38
Makefile.variables
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
export PROJECT = yq
|
||||||
|
IMPORT_PATH := github.com/mikefarah/${PROJECT}
|
||||||
|
|
||||||
|
export GIT_COMMIT = $(shell git rev-parse --short HEAD)
|
||||||
|
export GIT_DIRTY = $(shell test -n "$$(git status --porcelain)" && echo "+CHANGES" || true)
|
||||||
|
export GIT_DESCRIBE = $(shell git describe --tags --always)
|
||||||
|
LDFLAGS :=
|
||||||
|
LDFLAGS += -X main.GitCommit=${GIT_COMMIT}${GIT_DIRTY}
|
||||||
|
LDFLAGS += -X main.GitDescribe=${GIT_DESCRIBE}
|
||||||
|
|
||||||
|
GITHUB_TOKEN ?=
|
||||||
|
|
||||||
|
# Windows environment?
|
||||||
|
CYG_CHECK := $(shell hash cygpath 2>/dev/null && echo 1)
|
||||||
|
ifeq ($(CYG_CHECK),1)
|
||||||
|
VBOX_CHECK := $(shell hash VBoxManage 2>/dev/null && echo 1)
|
||||||
|
|
||||||
|
# Docker Toolbox (pre-Windows 10)
|
||||||
|
ifeq ($(VBOX_CHECK),1)
|
||||||
|
ROOT := /${PROJECT}
|
||||||
|
else
|
||||||
|
# Docker Windows
|
||||||
|
ROOT := $(shell cygpath -m -a "$(shell pwd)")
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
# all non-windows environments
|
||||||
|
ROOT := $(shell pwd)
|
||||||
|
endif
|
||||||
|
|
||||||
|
DEV_IMAGE := ${PROJECT}_dev
|
||||||
|
|
||||||
|
DOCKRUN := docker run --rm \
|
||||||
|
-e LDFLAGS="${LDFLAGS}" \
|
||||||
|
-e GITHUB_TOKEN="${GITHUB_TOKEN}" \
|
||||||
|
-v ${ROOT}/vendor:/go/src \
|
||||||
|
-v ${ROOT}:/${PROJECT}/src/${IMPORT_PATH} \
|
||||||
|
-w /${PROJECT}/src/${IMPORT_PATH} \
|
||||||
|
${DEV_IMAGE}
|
||||||
160
README.md
160
README.md
@@ -1,73 +1,127 @@
|
|||||||
# yaml
|
# yq
|
||||||
yaml command line tool written in go
|
|
||||||
|
|
||||||
Allows you to read (and soon update) yaml files given a yaml path. All in a lovely dependency free binary!
|
[](https://travis-ci.org/mikefarah/yq)   
|
||||||
|
|
||||||
[Download latest release](https://github.com/mikefarah/yaml/releases/latest)
|
|
||||||
|
|
||||||
or alternatively install using go get:
|
a lightweight and portable command-line YAML processor
|
||||||
|
|
||||||
|
The aim of the project is to be the [jq](https://github.com/stedolan/jq) or sed of yaml files.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
### On MacOS:
|
||||||
```
|
```
|
||||||
go get github.com/mikefarah/yaml
|
brew install yq
|
||||||
|
```
|
||||||
|
### On Ubuntu and other Linux distros supporting `snap` packages:
|
||||||
|
```
|
||||||
|
snap install yq
|
||||||
```
|
```
|
||||||
|
|
||||||
## Read examples
|
#### Snap notes
|
||||||
|
`yq` installs with 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:
|
||||||
|
|
||||||
```
|
```
|
||||||
yaml <yaml file> <path>
|
sudo cat /etc/myfile | yq -r - somecommand
|
||||||
```
|
```
|
||||||
|
|
||||||
### Basic
|
And to write to a root file you can either use [sponge](https://linux.die.net/man/1/sponge):
|
||||||
Given a sample.yaml file of:
|
|
||||||
```yaml
|
|
||||||
b:
|
|
||||||
c: 2
|
|
||||||
```
|
```
|
||||||
then
|
sudo cat /etc/myfile | yq -r - somecommand | sudo sponge /etc/myfile
|
||||||
|
```
|
||||||
|
or write to a temporary file:
|
||||||
|
```
|
||||||
|
sudo cat /etc/myfile | yq -r - somecommand | sudo tee /etc/myfile.tmp
|
||||||
|
sudo mv /etc/myfile.tmp /etc/myfile
|
||||||
|
rm /etc/myfile.tmp
|
||||||
|
```
|
||||||
|
|
||||||
|
### On Ubuntu 16.04 or higher from Debian package:
|
||||||
|
```
|
||||||
|
sudo add-apt-repository ppa:rmescandon/yq
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install yq -y
|
||||||
|
```
|
||||||
|
### or, [Download latest binary](https://github.com/mikefarah/yq/releases/latest) or alternatively:
|
||||||
|
```
|
||||||
|
GO111MODULE=on go get github.com/mikefarah/yq@2.4.1
|
||||||
|
```
|
||||||
|
|
||||||
|
## Run with Docker
|
||||||
|
|
||||||
|
Oneshot use:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
yaml sample.yaml b.c
|
docker run --rm -v ${PWD}:/workdir mikefarah/yq yq [flags] <command> FILE...
|
||||||
```
|
```
|
||||||
will output the value of '2'.
|
|
||||||
|
|
||||||
### Handling '.' in the yaml key
|
Run commands interactively:
|
||||||
Given a sample.yaml file of:
|
|
||||||
```yaml
|
|
||||||
b.x:
|
|
||||||
c: 2
|
|
||||||
```
|
|
||||||
then
|
|
||||||
```bash
|
```bash
|
||||||
yaml sample.yaml \"b.x\".c
|
docker run --rm -it -v ${PWD}:/workdir mikefarah/yq sh
|
||||||
```
|
```
|
||||||
will output the value of '2'.
|
|
||||||
|
|
||||||
### Arrays
|
It can be useful to have a bash function to avoid typing the whole docker command:
|
||||||
You can give an index to access a specific element:
|
|
||||||
e.g.: given a sample file of
|
|
||||||
```yaml
|
|
||||||
b:
|
|
||||||
e:
|
|
||||||
- name: fred
|
|
||||||
value: 3
|
|
||||||
- name: sam
|
|
||||||
value: 4
|
|
||||||
```
|
|
||||||
then
|
|
||||||
```
|
|
||||||
yaml sample.yaml b.e[1].name
|
|
||||||
```
|
|
||||||
will output 'sam'
|
|
||||||
|
|
||||||
### Updating yaml
|
|
||||||
Given a sample.yaml file of:
|
|
||||||
```yaml
|
|
||||||
b:
|
|
||||||
c: 2
|
|
||||||
```
|
|
||||||
then
|
|
||||||
```bash
|
```bash
|
||||||
yaml w sample.yaml b.c 'cat'
|
yq() {
|
||||||
|
docker run --rm -i -v ${PWD}:/workdir mikefarah/yq yq $@
|
||||||
|
}
|
||||||
```
|
```
|
||||||
will output:
|
|
||||||
```yaml
|
## Features
|
||||||
b:
|
- Written in portable go, so you can download a lovely dependency free binary
|
||||||
c: cat
|
- Deep read a yaml file with a given path
|
||||||
|
- Update a yaml file given a path
|
||||||
|
- Update a yaml file given a script file
|
||||||
|
- Update creates any missing entries in the path on the fly
|
||||||
|
- Create a yaml file given a deep path and value
|
||||||
|
- Create a yaml file given a script file
|
||||||
|
- Prefix a path to a yaml file
|
||||||
|
- Convert from json to yaml
|
||||||
|
- Convert from yaml to json
|
||||||
|
- Pipe data in by using '-'
|
||||||
|
- Merge multiple yaml files where each additional file sets values for missing or null value keys.
|
||||||
|
- Merge multiple yaml files and override previous values.
|
||||||
|
- Merge multiple yaml files and append array values.
|
||||||
|
- Supports multiple documents in a single yaml file
|
||||||
|
|
||||||
|
## [Usage](http://mikefarah.github.io/yq/)
|
||||||
|
|
||||||
|
Check out the [documentation](http://mikefarah.github.io/yq/) for more detailed and advanced usage.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
yq is a lightweight and portable command-line YAML processor. It aims to be the jq or sed of yaml files.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
yq [flags]
|
||||||
|
yq [command]
|
||||||
|
|
||||||
|
Available Commands:
|
||||||
|
delete yq d [--inplace/-i] [--doc/-d index] sample.yaml a.b.c
|
||||||
|
help Help about any command
|
||||||
|
merge yq m [--inplace/-i] [--doc/-d index] [--overwrite/-x] [--append/-a] sample.yaml sample2.yaml
|
||||||
|
new yq n [--script/-s script_file] a.b.c newValue
|
||||||
|
prefix yq p [--inplace/-i] [--doc/-d index] sample.yaml a.b.c
|
||||||
|
read yq r [--doc/-d index] sample.yaml a.b.c
|
||||||
|
write yq w [--inplace/-i] [--script/-s script_file] [--doc/-d index] sample.yaml a.b.c newValue
|
||||||
|
|
||||||
|
Flags:
|
||||||
|
-h, --help help for yq
|
||||||
|
-t, --trim trim yaml output (default true)
|
||||||
|
-v, --verbose verbose mode
|
||||||
|
-V, --version Print version information and quit
|
||||||
|
|
||||||
|
Use "yq [command] --help" for more information about a command.
|
||||||
|
```
|
||||||
|
|
||||||
|
## Contribute
|
||||||
|
1. `scripts/devtools.sh`
|
||||||
|
2. `make [local] vendor`
|
||||||
|
3. add unit tests
|
||||||
|
4. apply changes to go.mod
|
||||||
|
5. `make [local] build`
|
||||||
|
6. If required, update the user documentation
|
||||||
|
- Update README.md and/or documentation under the mkdocs folder
|
||||||
|
- `make [local] build-docs`
|
||||||
|
- browse to docs/index.html and check your changes
|
||||||
|
7. profit
|
||||||
|
|||||||
1266
commands_test.go
Normal file
1266
commands_test.go
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,50 +1,349 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
// "fmt"
|
"fmt"
|
||||||
"log"
|
"reflect"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
yaml "github.com/mikefarah/yaml/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
func write(context map[interface{}]interface{}, head string, tail []string, value interface{}) {
|
func matchesKey(key string, actual interface{}) bool {
|
||||||
// e.g. if updating a.b.c, we need to get the 'b' map...
|
var actualString = fmt.Sprintf("%v", actual)
|
||||||
toUpdate := readMap(context, head, tail[0:len(tail)-1]).(map[interface{}]interface{})
|
var prefixMatch = strings.TrimSuffix(key, "*")
|
||||||
// and then set the 'c' key.
|
if prefixMatch != key {
|
||||||
key := (tail[len(tail)-1])
|
return strings.HasPrefix(actualString, prefixMatch)
|
||||||
toUpdate[key] = value
|
|
||||||
}
|
|
||||||
|
|
||||||
func readMap(context map[interface{}]interface{}, head string, tail []string) interface{} {
|
|
||||||
value := context[head]
|
|
||||||
if len(tail) > 0 {
|
|
||||||
return recurse(value, tail[0], tail[1:len(tail)])
|
|
||||||
}
|
}
|
||||||
return value
|
return actualString == key
|
||||||
}
|
}
|
||||||
|
|
||||||
func recurse(value interface{}, head string, tail []string) interface{} {
|
func entriesInSlice(context yaml.MapSlice, key string) []*yaml.MapItem {
|
||||||
switch value.(type) {
|
var matches = make([]*yaml.MapItem, 0)
|
||||||
|
for idx := range context {
|
||||||
|
var entry = &context[idx]
|
||||||
|
if matchesKey(key, entry.Key) {
|
||||||
|
matches = append(matches, entry)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return matches
|
||||||
|
}
|
||||||
|
|
||||||
|
func getMapSlice(context interface{}) yaml.MapSlice {
|
||||||
|
var mapSlice yaml.MapSlice
|
||||||
|
switch context := context.(type) {
|
||||||
|
case yaml.MapSlice:
|
||||||
|
mapSlice = context
|
||||||
|
default:
|
||||||
|
mapSlice = make(yaml.MapSlice, 0)
|
||||||
|
}
|
||||||
|
return mapSlice
|
||||||
|
}
|
||||||
|
|
||||||
|
func getArray(context interface{}) (array []interface{}, ok bool) {
|
||||||
|
switch context := context.(type) {
|
||||||
case []interface{}:
|
case []interface{}:
|
||||||
|
array = context
|
||||||
|
ok = true
|
||||||
|
default:
|
||||||
|
array = make([]interface{}, 0)
|
||||||
|
ok = false
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func writeMap(context interface{}, paths []string, value interface{}) interface{} {
|
||||||
|
log.Debugf("writeMap with path %v for %v to set value %v\n", paths, context, value)
|
||||||
|
|
||||||
|
mapSlice := getMapSlice(context)
|
||||||
|
|
||||||
|
if len(paths) == 0 {
|
||||||
|
return context
|
||||||
|
}
|
||||||
|
|
||||||
|
children := entriesInSlice(mapSlice, paths[0])
|
||||||
|
|
||||||
|
if len(children) == 0 && paths[0] == "*" {
|
||||||
|
log.Debugf("\tNo matches, return map as is")
|
||||||
|
return context
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(children) == 0 {
|
||||||
|
newChild := yaml.MapItem{Key: paths[0]}
|
||||||
|
mapSlice = append(mapSlice, newChild)
|
||||||
|
children = entriesInSlice(mapSlice, paths[0])
|
||||||
|
log.Debugf("\tAppended child at %v for mapSlice %v\n", paths[0], mapSlice)
|
||||||
|
}
|
||||||
|
|
||||||
|
remainingPaths := paths[1:]
|
||||||
|
for _, child := range children {
|
||||||
|
child.Value = updatedChildValue(child.Value, remainingPaths, value)
|
||||||
|
}
|
||||||
|
log.Debugf("\tReturning mapSlice %v\n", mapSlice)
|
||||||
|
return mapSlice
|
||||||
|
}
|
||||||
|
|
||||||
|
func updatedChildValue(child interface{}, remainingPaths []string, value interface{}) interface{} {
|
||||||
|
if len(remainingPaths) == 0 {
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
log.Debugf("updatedChildValue for child %v with path %v to set value %v", child, remainingPaths, value)
|
||||||
|
log.Debugf("type of child is %v", reflect.TypeOf(child))
|
||||||
|
|
||||||
|
switch child := child.(type) {
|
||||||
|
case nil:
|
||||||
|
if remainingPaths[0] == "+" || remainingPaths[0] == "*" {
|
||||||
|
return writeArray(child, remainingPaths, value)
|
||||||
|
}
|
||||||
|
case []interface{}:
|
||||||
|
_, nextIndexErr := strconv.ParseInt(remainingPaths[0], 10, 64)
|
||||||
|
arrayCommand := nextIndexErr == nil || remainingPaths[0] == "+" || remainingPaths[0] == "*"
|
||||||
|
if arrayCommand {
|
||||||
|
return writeArray(child, remainingPaths, value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return writeMap(child, remainingPaths, value)
|
||||||
|
}
|
||||||
|
|
||||||
|
func writeArray(context interface{}, paths []string, value interface{}) []interface{} {
|
||||||
|
log.Debugf("writeArray with path %v for %v to set value %v\n", paths, context, value)
|
||||||
|
array, _ := getArray(context)
|
||||||
|
|
||||||
|
if len(paths) == 0 {
|
||||||
|
return array
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Debugf("\tarray %v\n", array)
|
||||||
|
|
||||||
|
rawIndex := paths[0]
|
||||||
|
remainingPaths := paths[1:]
|
||||||
|
var index int64
|
||||||
|
// the append array indicator
|
||||||
|
if rawIndex == "+" {
|
||||||
|
index = int64(len(array))
|
||||||
|
} else if rawIndex == "*" {
|
||||||
|
for index, oldChild := range array {
|
||||||
|
array[index] = updatedChildValue(oldChild, remainingPaths, value)
|
||||||
|
}
|
||||||
|
return array
|
||||||
|
} else {
|
||||||
|
index, _ = strconv.ParseInt(rawIndex, 10, 64) // nolint
|
||||||
|
// writeArray is only called by updatedChildValue which handles parsing the
|
||||||
|
// index, as such this renders this dead code.
|
||||||
|
}
|
||||||
|
|
||||||
|
for index >= int64(len(array)) {
|
||||||
|
array = append(array, nil)
|
||||||
|
}
|
||||||
|
currentChild := array[index]
|
||||||
|
|
||||||
|
log.Debugf("\tcurrentChild %v\n", currentChild)
|
||||||
|
|
||||||
|
array[index] = updatedChildValue(currentChild, remainingPaths, value)
|
||||||
|
log.Debugf("\tReturning array %v\n", array)
|
||||||
|
return array
|
||||||
|
}
|
||||||
|
|
||||||
|
func readMap(context yaml.MapSlice, head string, tail []string) (interface{}, error) {
|
||||||
|
log.Debugf("readingMap %v with key %v\n", context, head)
|
||||||
|
if head == "*" {
|
||||||
|
return readMapSplat(context, tail)
|
||||||
|
}
|
||||||
|
|
||||||
|
entries := entriesInSlice(context, head)
|
||||||
|
if len(entries) == 1 {
|
||||||
|
return calculateValue(entries[0].Value, tail)
|
||||||
|
} else if len(entries) == 0 {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
var errInIdx error
|
||||||
|
values := make([]interface{}, len(entries))
|
||||||
|
for idx, entry := range entries {
|
||||||
|
values[idx], errInIdx = calculateValue(entry.Value, tail)
|
||||||
|
if errInIdx != nil {
|
||||||
|
log.Errorf("Error updating index %v in %v", idx, context)
|
||||||
|
return nil, errInIdx
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return values, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func readMapSplat(context yaml.MapSlice, tail []string) (interface{}, error) {
|
||||||
|
var newArray = make([]interface{}, len(context))
|
||||||
|
var i = 0
|
||||||
|
for _, entry := range context {
|
||||||
|
if len(tail) > 0 {
|
||||||
|
val, err := recurse(entry.Value, tail[0], tail[1:])
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
newArray[i] = val
|
||||||
|
} else {
|
||||||
|
newArray[i] = entry.Value
|
||||||
|
}
|
||||||
|
i++
|
||||||
|
}
|
||||||
|
return newArray, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func recurse(value interface{}, head string, tail []string) (interface{}, error) {
|
||||||
|
switch value := value.(type) {
|
||||||
|
case []interface{}:
|
||||||
|
if head == "*" {
|
||||||
|
return readArraySplat(value, tail)
|
||||||
|
}
|
||||||
index, err := strconv.ParseInt(head, 10, 64)
|
index, err := strconv.ParseInt(head, 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Error accessing array: %v", err)
|
return nil, fmt.Errorf("error accessing array: %v", err)
|
||||||
}
|
}
|
||||||
return readArray(value.([]interface{}), index, tail)
|
return readArray(value, index, tail)
|
||||||
case nil:
|
case yaml.MapSlice:
|
||||||
return nil
|
return readMap(value, head, tail)
|
||||||
default:
|
default:
|
||||||
return readMap(value.(map[interface{}]interface{}), head, tail)
|
return nil, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func readArray(array []interface{}, head int64, tail []string) interface{} {
|
func readArray(array []interface{}, head int64, tail []string) (interface{}, error) {
|
||||||
if head > int64(len(array)) {
|
if head >= int64(len(array)) {
|
||||||
return nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
value := array[head]
|
value := array[head]
|
||||||
if len(tail) > 0 {
|
return calculateValue(value, tail)
|
||||||
return recurse(value, tail[0], tail[1:len(tail)])
|
}
|
||||||
}
|
|
||||||
return value
|
func readArraySplat(array []interface{}, tail []string) (interface{}, error) {
|
||||||
|
var newArray = make([]interface{}, len(array))
|
||||||
|
for index, value := range array {
|
||||||
|
val, err := calculateValue(value, tail)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
newArray[index] = val
|
||||||
|
}
|
||||||
|
return newArray, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func calculateValue(value interface{}, tail []string) (interface{}, error) {
|
||||||
|
if len(tail) > 0 {
|
||||||
|
return recurse(value, tail[0], tail[1:])
|
||||||
|
}
|
||||||
|
return value, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func deleteMap(context interface{}, paths []string) (yaml.MapSlice, error) {
|
||||||
|
log.Debugf("deleteMap for %v for %v\n", paths, context)
|
||||||
|
|
||||||
|
mapSlice := getMapSlice(context)
|
||||||
|
|
||||||
|
if len(paths) == 0 {
|
||||||
|
return mapSlice, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var index int
|
||||||
|
var child yaml.MapItem
|
||||||
|
for index, child = range mapSlice {
|
||||||
|
if matchesKey(paths[0], child.Key) {
|
||||||
|
log.Debugf("\tMatched [%v] with [%v] at index %v", paths[0], child.Key, index)
|
||||||
|
var badDelete error
|
||||||
|
mapSlice, badDelete = deleteEntryInMap(mapSlice, child, index, paths)
|
||||||
|
if badDelete != nil {
|
||||||
|
return nil, badDelete
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return mapSlice, nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func deleteEntryInMap(original yaml.MapSlice, child yaml.MapItem, index int, paths []string) (yaml.MapSlice, error) {
|
||||||
|
remainingPaths := paths[1:]
|
||||||
|
|
||||||
|
var newSlice yaml.MapSlice
|
||||||
|
if len(remainingPaths) > 0 {
|
||||||
|
newChild := yaml.MapItem{Key: child.Key}
|
||||||
|
var errorDeleting error
|
||||||
|
newChild.Value, errorDeleting = deleteChildValue(child.Value, remainingPaths)
|
||||||
|
if errorDeleting != nil {
|
||||||
|
return nil, errorDeleting
|
||||||
|
}
|
||||||
|
|
||||||
|
newSlice = make(yaml.MapSlice, len(original))
|
||||||
|
for i := range original {
|
||||||
|
item := original[i]
|
||||||
|
if i == index {
|
||||||
|
item = newChild
|
||||||
|
}
|
||||||
|
newSlice[i] = item
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Delete item from slice at index
|
||||||
|
newSlice = append(original[:index], original[index+1:]...)
|
||||||
|
log.Debugf("\tDeleted item index %d from original", index)
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Debugf("\tReturning original %v\n", original)
|
||||||
|
return newSlice, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func deleteArraySplat(array []interface{}, tail []string) (interface{}, error) {
|
||||||
|
log.Debugf("deleteArraySplat for %v for %v\n", tail, array)
|
||||||
|
var newArray = make([]interface{}, len(array))
|
||||||
|
for index, value := range array {
|
||||||
|
val, err := deleteChildValue(value, tail)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
newArray[index] = val
|
||||||
|
}
|
||||||
|
return newArray, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func deleteArray(array []interface{}, paths []string, index int64) (interface{}, error) {
|
||||||
|
log.Debugf("deleteArray for %v for %v\n", paths, array)
|
||||||
|
|
||||||
|
if index >= int64(len(array)) {
|
||||||
|
return array, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
remainingPaths := paths[1:]
|
||||||
|
if len(remainingPaths) > 0 {
|
||||||
|
// Recurse into the array element at index
|
||||||
|
var errorDeleting error
|
||||||
|
array[index], errorDeleting = deleteMap(array[index], remainingPaths)
|
||||||
|
if errorDeleting != nil {
|
||||||
|
return nil, errorDeleting
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// Delete the array element at index
|
||||||
|
array = append(array[:index], array[index+1:]...)
|
||||||
|
log.Debugf("\tDeleted item index %d from array, leaving %v", index, array)
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Debugf("\tReturning array: %v\n", array)
|
||||||
|
return array, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func deleteChildValue(child interface{}, remainingPaths []string) (interface{}, error) {
|
||||||
|
log.Debugf("deleteChildValue for %v for %v\n", remainingPaths, child)
|
||||||
|
var head = remainingPaths[0]
|
||||||
|
var tail = remainingPaths[1:]
|
||||||
|
switch child := child.(type) {
|
||||||
|
case yaml.MapSlice:
|
||||||
|
return deleteMap(child, remainingPaths)
|
||||||
|
case []interface{}:
|
||||||
|
if head == "*" {
|
||||||
|
return deleteArraySplat(child, tail)
|
||||||
|
}
|
||||||
|
index, err := strconv.ParseInt(head, 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("error accessing array: %v", err)
|
||||||
|
}
|
||||||
|
return deleteArray(child, remainingPaths, index)
|
||||||
|
}
|
||||||
|
return child, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,63 +2,398 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"gopkg.in/yaml.v2"
|
"sort"
|
||||||
"os"
|
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
var rawData = `
|
func TestReadMap_simple(t *testing.T) {
|
||||||
a: Easy!
|
var data = parseData(`
|
||||||
|
---
|
||||||
b:
|
b:
|
||||||
c: 2
|
c: 2
|
||||||
d: [3, 4]
|
`)
|
||||||
`
|
got, _ := readMap(data, "b", []string{"c"})
|
||||||
|
assertResult(t, 2, got)
|
||||||
var parsedData map[interface{}]interface{}
|
|
||||||
|
|
||||||
func TestMain(m *testing.M) {
|
|
||||||
err := yaml.Unmarshal([]byte(rawData), &parsedData)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Println("Error parsing yaml: %v", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
os.Exit(m.Run())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestReadMap_simple(t *testing.T) {
|
func TestReadMap_numberKey(t *testing.T) {
|
||||||
assertResult(t, 2, readMap(parsedData, "b", []string{"c"}))
|
var data = parseData(`
|
||||||
|
---
|
||||||
|
200: things
|
||||||
|
`)
|
||||||
|
got, _ := readMap(data, "200", []string{})
|
||||||
|
assertResult(t, "things", got)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestReadMap_splat(t *testing.T) {
|
||||||
|
var data = parseData(`
|
||||||
|
---
|
||||||
|
mapSplat:
|
||||||
|
item1: things
|
||||||
|
item2: whatever
|
||||||
|
otherThing: cat
|
||||||
|
`)
|
||||||
|
res, _ := readMap(data, "mapSplat", []string{"*"})
|
||||||
|
assertResult(t, "[things whatever cat]", fmt.Sprintf("%v", res))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestReadMap_prefixSplat(t *testing.T) {
|
||||||
|
var data = parseData(`
|
||||||
|
---
|
||||||
|
mapSplat:
|
||||||
|
item1: things
|
||||||
|
item2: whatever
|
||||||
|
otherThing: cat
|
||||||
|
`)
|
||||||
|
res, _ := readMap(data, "mapSplat", []string{"item*"})
|
||||||
|
assertResult(t, "[things whatever]", fmt.Sprintf("%v", res))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestReadMap_deep_splat(t *testing.T) {
|
||||||
|
var data = parseData(`
|
||||||
|
---
|
||||||
|
mapSplatDeep:
|
||||||
|
item1:
|
||||||
|
cats: bananas
|
||||||
|
item2:
|
||||||
|
cats: apples
|
||||||
|
`)
|
||||||
|
|
||||||
|
res, _ := readMap(data, "mapSplatDeep", []string{"*", "cats"})
|
||||||
|
result := res.([]interface{})
|
||||||
|
var actual = []string{result[0].(string), result[1].(string)}
|
||||||
|
sort.Strings(actual)
|
||||||
|
assertResult(t, "[apples bananas]", fmt.Sprintf("%v", actual))
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestReadMap_key_doesnt_exist(t *testing.T) {
|
func TestReadMap_key_doesnt_exist(t *testing.T) {
|
||||||
assertResult(t, nil, readMap(parsedData, "b.x.f", []string{"c"}))
|
var data = parseData(`
|
||||||
|
---
|
||||||
|
b:
|
||||||
|
c: 2
|
||||||
|
`)
|
||||||
|
got, _ := readMap(data, "b.x.f", []string{"c"})
|
||||||
|
assertResult(t, nil, got)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestReadMap_recurse_against_string(t *testing.T) {
|
||||||
|
var data = parseData(`
|
||||||
|
---
|
||||||
|
a: cat
|
||||||
|
`)
|
||||||
|
got, _ := readMap(data, "a", []string{"b"})
|
||||||
|
assertResult(t, nil, got)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestReadMap_with_array(t *testing.T) {
|
func TestReadMap_with_array(t *testing.T) {
|
||||||
assertResult(t, 4, readMap(parsedData, "b", []string{"d", "1"}))
|
var data = parseData(`
|
||||||
|
---
|
||||||
|
b:
|
||||||
|
d:
|
||||||
|
- 3
|
||||||
|
- 4
|
||||||
|
`)
|
||||||
|
got, _ := readMap(data, "b", []string{"d", "1"})
|
||||||
|
assertResult(t, 4, got)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestReadMap_with_array_and_bad_index(t *testing.T) {
|
||||||
|
var data = parseData(`
|
||||||
|
---
|
||||||
|
b:
|
||||||
|
d:
|
||||||
|
- 3
|
||||||
|
- 4
|
||||||
|
`)
|
||||||
|
_, err := readMap(data, "b", []string{"d", "x"})
|
||||||
|
if err == nil {
|
||||||
|
t.Fatal("Expected error due to invalid path")
|
||||||
|
}
|
||||||
|
expectedOutput := `error accessing array: strconv.ParseInt: parsing "x": invalid syntax`
|
||||||
|
assertResult(t, expectedOutput, err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestReadMap_with_mapsplat_array_and_bad_index(t *testing.T) {
|
||||||
|
var data = parseData(`
|
||||||
|
---
|
||||||
|
b:
|
||||||
|
d:
|
||||||
|
e:
|
||||||
|
- 3
|
||||||
|
- 4
|
||||||
|
f:
|
||||||
|
- 1
|
||||||
|
- 2
|
||||||
|
`)
|
||||||
|
_, err := readMap(data, "b", []string{"d", "*", "x"})
|
||||||
|
if err == nil {
|
||||||
|
t.Fatal("Expected error due to invalid path")
|
||||||
|
}
|
||||||
|
expectedOutput := `error accessing array: strconv.ParseInt: parsing "x": invalid syntax`
|
||||||
|
assertResult(t, expectedOutput, err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestReadMap_with_arraysplat_map_array_and_bad_index(t *testing.T) {
|
||||||
|
var data = parseData(`
|
||||||
|
---
|
||||||
|
b:
|
||||||
|
d:
|
||||||
|
- names:
|
||||||
|
- fred
|
||||||
|
- smith
|
||||||
|
- names:
|
||||||
|
- sam
|
||||||
|
- bo
|
||||||
|
`)
|
||||||
|
_, err := readMap(data, "b", []string{"d", "*", "names", "x"})
|
||||||
|
if err == nil {
|
||||||
|
t.Fatal("Expected error due to invalid path")
|
||||||
|
}
|
||||||
|
expectedOutput := `error accessing array: strconv.ParseInt: parsing "x": invalid syntax`
|
||||||
|
assertResult(t, expectedOutput, err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestReadMap_with_array_out_of_bounds(t *testing.T) {
|
func TestReadMap_with_array_out_of_bounds(t *testing.T) {
|
||||||
assertResult(t, nil, readMap(parsedData, "b", []string{"d", "3"}))
|
var data = parseData(`
|
||||||
|
---
|
||||||
|
b:
|
||||||
|
d:
|
||||||
|
- 3
|
||||||
|
- 4
|
||||||
|
`)
|
||||||
|
got, _ := readMap(data, "b", []string{"d", "3"})
|
||||||
|
assertResult(t, nil, got)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestReadMap_with_array_out_of_bounds_by_1(t *testing.T) {
|
||||||
|
var data = parseData(`
|
||||||
|
---
|
||||||
|
b:
|
||||||
|
d:
|
||||||
|
- 3
|
||||||
|
- 4
|
||||||
|
`)
|
||||||
|
got, _ := readMap(data, "b", []string{"d", "2"})
|
||||||
|
assertResult(t, nil, got)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestReadMap_with_array_splat(t *testing.T) {
|
||||||
|
var data = parseData(`
|
||||||
|
e:
|
||||||
|
-
|
||||||
|
name: Fred
|
||||||
|
thing: cat
|
||||||
|
-
|
||||||
|
name: Sam
|
||||||
|
thing: dog
|
||||||
|
`)
|
||||||
|
got, _ := readMap(data, "e", []string{"*", "name"})
|
||||||
|
assertResult(t, "[Fred Sam]", fmt.Sprintf("%v", got))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestWrite_really_simple(t *testing.T) {
|
||||||
|
var data = parseData(`
|
||||||
|
b: 2
|
||||||
|
`)
|
||||||
|
|
||||||
|
updated := writeMap(data, []string{"b"}, "4")
|
||||||
|
assertResult(t, "[{b 4}]", fmt.Sprintf("%v", updated))
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestWrite_simple(t *testing.T) {
|
func TestWrite_simple(t *testing.T) {
|
||||||
|
var data = parseData(`
|
||||||
|
b:
|
||||||
|
c: 2
|
||||||
|
`)
|
||||||
|
|
||||||
write(parsedData, "b", []string{"c"}, "4")
|
updated := writeMap(data, []string{"b", "c"}, "4")
|
||||||
|
assertResult(t, "[{b [{c 4}]}]", fmt.Sprintf("%v", updated))
|
||||||
b := parsedData["b"].(map[interface{}]interface{})
|
|
||||||
assertResult(t, "4", b["c"].(string))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func assertResult(t *testing.T, expectedValue interface{}, actualValue interface{}) {
|
func TestWrite_new(t *testing.T) {
|
||||||
if expectedValue != actualValue {
|
var data = parseData(`
|
||||||
t.Error("Expected <", expectedValue, "> but got <", actualValue, ">")
|
b:
|
||||||
}
|
c: 2
|
||||||
|
`)
|
||||||
|
|
||||||
|
updated := writeMap(data, []string{"b", "d"}, "4")
|
||||||
|
assertResult(t, "[{b [{c 2} {d 4}]}]", fmt.Sprintf("%v", updated))
|
||||||
}
|
}
|
||||||
|
|
||||||
func assertResultWithContext(t *testing.T, expectedValue interface{}, actualValue interface{}, context interface{}) {
|
func TestWrite_new_deep(t *testing.T) {
|
||||||
if expectedValue != actualValue {
|
var data = parseData(`
|
||||||
t.Error(context)
|
b:
|
||||||
t.Error(": expected <", expectedValue, "> but got <", actualValue, ">")
|
c: 2
|
||||||
}
|
`)
|
||||||
|
|
||||||
|
updated := writeMap(data, []string{"b", "d", "f"}, "4")
|
||||||
|
assertResult(t, "[{b [{c 2} {d [{f 4}]}]}]", fmt.Sprintf("%v", updated))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestWrite_array(t *testing.T) {
|
||||||
|
var data = parseData(`
|
||||||
|
b:
|
||||||
|
- aa
|
||||||
|
`)
|
||||||
|
|
||||||
|
updated := writeMap(data, []string{"b", "0"}, "bb")
|
||||||
|
|
||||||
|
assertResult(t, "[{b [bb]}]", fmt.Sprintf("%v", updated))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestWrite_new_array(t *testing.T) {
|
||||||
|
var data = parseData(`
|
||||||
|
b:
|
||||||
|
c: 2
|
||||||
|
`)
|
||||||
|
|
||||||
|
updated := writeMap(data, []string{"b", "0"}, "4")
|
||||||
|
assertResult(t, "[{b [{c 2} {0 4}]}]", fmt.Sprintf("%v", updated))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestWrite_new_array_deep(t *testing.T) {
|
||||||
|
var data = parseData(`
|
||||||
|
a: apple
|
||||||
|
`)
|
||||||
|
|
||||||
|
var expected = `a: apple
|
||||||
|
b:
|
||||||
|
- c: "4"`
|
||||||
|
|
||||||
|
updated := writeMap(data, []string{"b", "+", "c"}, "4")
|
||||||
|
got, _ := yamlToString(updated)
|
||||||
|
assertResult(t, expected, got)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestWrite_new_map_array_deep(t *testing.T) {
|
||||||
|
var data = parseData(`
|
||||||
|
b:
|
||||||
|
c: 2
|
||||||
|
`)
|
||||||
|
var expected = `b:
|
||||||
|
c: 2
|
||||||
|
d:
|
||||||
|
- "4"`
|
||||||
|
|
||||||
|
updated := writeMap(data, []string{"b", "d", "+"}, "4")
|
||||||
|
got, _ := yamlToString(updated)
|
||||||
|
assertResult(t, expected, got)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestWrite_add_to_array(t *testing.T) {
|
||||||
|
var data = parseData(`
|
||||||
|
b:
|
||||||
|
- aa
|
||||||
|
`)
|
||||||
|
|
||||||
|
var expected = `b:
|
||||||
|
- aa
|
||||||
|
- bb`
|
||||||
|
|
||||||
|
updated := writeMap(data, []string{"b", "1"}, "bb")
|
||||||
|
got, _ := yamlToString(updated)
|
||||||
|
assertResult(t, expected, got)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestWrite_with_no_tail(t *testing.T) {
|
||||||
|
var data = parseData(`
|
||||||
|
b:
|
||||||
|
c: 2
|
||||||
|
`)
|
||||||
|
updated := writeMap(data, []string{"b"}, "4")
|
||||||
|
|
||||||
|
assertResult(t, "[{b 4}]", fmt.Sprintf("%v", updated))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestWriteMap_no_paths(t *testing.T) {
|
||||||
|
var data = parseData(`
|
||||||
|
b: 5
|
||||||
|
`)
|
||||||
|
|
||||||
|
result := writeMap(data, []string{}, 4)
|
||||||
|
assertResult(t, fmt.Sprintf("%v", data), fmt.Sprintf("%v", result))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestWriteArray_no_paths(t *testing.T) {
|
||||||
|
var data = make([]interface{}, 1)
|
||||||
|
data[0] = "mike"
|
||||||
|
result := writeArray(data, []string{}, 4)
|
||||||
|
assertResult(t, fmt.Sprintf("%v", data), fmt.Sprintf("%v", result))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestDelete_MapItem(t *testing.T) {
|
||||||
|
var data = parseData(`
|
||||||
|
a: 123
|
||||||
|
b: 456
|
||||||
|
`)
|
||||||
|
var expected = parseData(`
|
||||||
|
b: 456
|
||||||
|
`)
|
||||||
|
|
||||||
|
result, _ := deleteMap(data, []string{"a"})
|
||||||
|
assertResult(t, fmt.Sprintf("%v", expected), fmt.Sprintf("%v", result))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ensure deleting an index into a string does nothing
|
||||||
|
func TestDelete_index_to_string(t *testing.T) {
|
||||||
|
var data = parseData(`
|
||||||
|
a: mystring
|
||||||
|
`)
|
||||||
|
result, _ := deleteMap(data, []string{"a", "0"})
|
||||||
|
assertResult(t, fmt.Sprintf("%v", data), fmt.Sprintf("%v", result))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestDelete_list_index(t *testing.T) {
|
||||||
|
var data = parseData(`
|
||||||
|
a: [3, 4]
|
||||||
|
`)
|
||||||
|
var expected = parseData(`
|
||||||
|
a: [3]
|
||||||
|
`)
|
||||||
|
result, _ := deleteMap(data, []string{"a", "1"})
|
||||||
|
assertResult(t, fmt.Sprintf("%v", expected), fmt.Sprintf("%v", result))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestDelete_list_index_beyond_bounds(t *testing.T) {
|
||||||
|
var data = parseData(`
|
||||||
|
a: [3, 4]
|
||||||
|
`)
|
||||||
|
result, _ := deleteMap(data, []string{"a", "5"})
|
||||||
|
assertResult(t, fmt.Sprintf("%v", data), fmt.Sprintf("%v", result))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestDelete_list_index_out_of_bounds_by_1(t *testing.T) {
|
||||||
|
var data = parseData(`
|
||||||
|
a: [3, 4]
|
||||||
|
`)
|
||||||
|
result, _ := deleteMap(data, []string{"a", "2"})
|
||||||
|
assertResult(t, fmt.Sprintf("%v", data), fmt.Sprintf("%v", result))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestDelete_no_paths(t *testing.T) {
|
||||||
|
var data = parseData(`
|
||||||
|
a: [3, 4]
|
||||||
|
b:
|
||||||
|
- name: test
|
||||||
|
`)
|
||||||
|
result, _ := deleteMap(data, []string{})
|
||||||
|
assertResult(t, fmt.Sprintf("%v", data), fmt.Sprintf("%v", result))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestDelete_array_map_item(t *testing.T) {
|
||||||
|
var data = parseData(`
|
||||||
|
b:
|
||||||
|
- name: fred
|
||||||
|
value: blah
|
||||||
|
- name: john
|
||||||
|
value: test
|
||||||
|
`)
|
||||||
|
var expected = parseData(`
|
||||||
|
b:
|
||||||
|
- value: blah
|
||||||
|
- name: john
|
||||||
|
value: test
|
||||||
|
`)
|
||||||
|
result, _ := deleteMap(data, []string{"b", "0", "name"})
|
||||||
|
assertResult(t, fmt.Sprintf("%v", expected), fmt.Sprintf("%v", result))
|
||||||
}
|
}
|
||||||
|
|||||||
31
debian/changelog
vendored
Normal file
31
debian/changelog
vendored
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
yq (2.2-1) bionic; urgency=medium
|
||||||
|
|
||||||
|
* Added Windows support for the "--inplace" command flag
|
||||||
|
* Prefix now supports arrays
|
||||||
|
* Add prefix command
|
||||||
|
* Bump Alpine version to 3.8
|
||||||
|
* Improved docker build process
|
||||||
|
* Lint fixes
|
||||||
|
* Build support for all linux architectures supported by gox
|
||||||
|
|
||||||
|
-- Roberto Mier Escandon <rmescandon@gmail.com> Sat, 19 Jan 2019 15:50:47 +0100
|
||||||
|
|
||||||
|
yq (2.1-0) bionic; urgency=medium
|
||||||
|
|
||||||
|
* Ability to read multiple documents in a single file
|
||||||
|
* Ability to append list items instead of overwriting
|
||||||
|
|
||||||
|
-- Roberto Mier Escandón <rmescandon@gmail.com> Tue, 10 Jul 2018 14:02:42 +0200
|
||||||
|
|
||||||
|
yq (2.0-0) bionic; urgency=medium
|
||||||
|
|
||||||
|
* Release 2.0.0
|
||||||
|
|
||||||
|
-- Roberto Mier Escandón <rmescandon@gmail.com> Wed, 20 Jun 2018 10:29:53 +0200
|
||||||
|
|
||||||
|
yq (1.15-0) bionic; urgency=medium
|
||||||
|
|
||||||
|
* Release 1.15
|
||||||
|
|
||||||
|
-- Roberto Mier Escandón <rmescandon@gmail.com> Wed, 06 Jun 2018 11:32:03 +0200
|
||||||
|
|
||||||
1
debian/compat
vendored
Normal file
1
debian/compat
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
9
|
||||||
22
debian/control
vendored
Normal file
22
debian/control
vendored
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
Source: yq
|
||||||
|
Section: devel
|
||||||
|
Priority: extra
|
||||||
|
Maintainer: Roberto Mier Escandón <rmescandon@gmail.com>
|
||||||
|
Build-Depends: debhelper (>= 9),
|
||||||
|
dh-golang,
|
||||||
|
golang-1.10-go,
|
||||||
|
rsync
|
||||||
|
Standards-Version: 3.9.6
|
||||||
|
Homepage: https://github.com/mikefarah/yq.git
|
||||||
|
Vcs-Browser: https://github.com/mikefarah/yq.git
|
||||||
|
Vcs-Git: https://github.com/mikefarah/yq.git
|
||||||
|
|
||||||
|
Package: yq
|
||||||
|
Architecture: any
|
||||||
|
Built-Using: ${misc:Built-Using}
|
||||||
|
Depends: ${shlibs:Depends},
|
||||||
|
${misc:Depends}
|
||||||
|
Description:
|
||||||
|
a lightweight and portable command-line YAML processor
|
||||||
|
.
|
||||||
|
The aim of the project is to be the [jq](https://github.com/stedolan/jq) or sed of yaml files.
|
||||||
7
debian/copyright
vendored
Normal file
7
debian/copyright
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||||
|
Upstream-Name: yq
|
||||||
|
Source: https://github.com/mikefarah/yq.git
|
||||||
|
|
||||||
|
Files: *
|
||||||
|
Copyright: 2017 Mike Farah Ltd. All rights reserved
|
||||||
|
License: Proprietary
|
||||||
2
debian/gbp.conf
vendored
Normal file
2
debian/gbp.conf
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[DEFAULT]
|
||||||
|
pristine-tar = True
|
||||||
59
debian/rules
vendored
Executable file
59
debian/rules
vendored
Executable file
@@ -0,0 +1,59 @@
|
|||||||
|
#!/usr/bin/make -f
|
||||||
|
#
|
||||||
|
# Copyright (C) 2018 Roberto Mier Escandón <rmescandon@gmail.com>
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
# published by the Free Software Foundation.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
PROJECT := yq
|
||||||
|
OWNER := mikefarah
|
||||||
|
REPO := github.com
|
||||||
|
GOVERSION := 1.10
|
||||||
|
export DH_OPTIONS
|
||||||
|
export DH_GOPKG := ${REPO}/${OWNER}/${PROJECT}
|
||||||
|
export GOROOT := /usr/lib/go-${GOVERSION}
|
||||||
|
export GOPATH := ${CURDIR}/_build
|
||||||
|
export GOBIN := ${GOPATH}/bin
|
||||||
|
export PATH := ${GOROOT}/bin:${GOBIN}:${PATH}
|
||||||
|
BLDPATH := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
|
||||||
|
SRCDIR := ${CURDIR}/_build/src/${DH_GOPKG}
|
||||||
|
DESTDIR := ${CURDIR}/debian/${PROJECT}
|
||||||
|
BINDIR := /usr/bin
|
||||||
|
ASSETSDIR := /usr/share/${PROJECT}
|
||||||
|
|
||||||
|
%:
|
||||||
|
dh $@ --buildsystem=golang --with=golang
|
||||||
|
|
||||||
|
override_dh_auto_build:
|
||||||
|
mkdir -p ${SRCDIR}
|
||||||
|
mkdir -p ${GOBIN}
|
||||||
|
# copy project to local srcdir to build from there
|
||||||
|
rsync -avz --progress --exclude=obj-${BLDPATH} --exclude=debian . $(SRCDIR)
|
||||||
|
# build go code
|
||||||
|
(cd ${SRCDIR} && go install ./...)
|
||||||
|
|
||||||
|
override_dh_auto_test:
|
||||||
|
(cd ${SRCDIR} && go test -v ./...)
|
||||||
|
|
||||||
|
override_dh_auto_install:
|
||||||
|
mkdir -p ${DESTDIR}/${BINDIR}
|
||||||
|
mkdir -p ${DESTDIR}/${ASSETSDIR}
|
||||||
|
cp ${CURDIR}/_build/bin/yq ${DESTDIR}/${BINDIR}
|
||||||
|
cp -rf ${SRCDIR}/LICENSE ${DESTDIR}/${ASSETSDIR}
|
||||||
|
cp -rf ${SRCDIR}/README.md ${DESTDIR}/${PLUGINSDIR}
|
||||||
|
chmod a+x ${DESTDIR}/${BINDIR}/yq
|
||||||
|
|
||||||
|
override_dh_auto_clean:
|
||||||
|
dh_clean
|
||||||
|
rm -rf ${CURDIR}/obj-${BLDPATH}
|
||||||
|
rm -rf ${CURDIR}/_build
|
||||||
1
debian/source/format
vendored
Normal file
1
debian/source/format
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
3.0 (native)
|
||||||
376
docs/404.html
Normal file
376
docs/404.html
Normal file
@@ -0,0 +1,376 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="en" class="no-js">
|
||||||
|
<head>
|
||||||
|
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||||
|
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<meta name="lang:clipboard.copy" content="Copy to clipboard">
|
||||||
|
|
||||||
|
<meta name="lang:clipboard.copied" content="Copied to clipboard">
|
||||||
|
|
||||||
|
<meta name="lang:search.language" content="en">
|
||||||
|
|
||||||
|
<meta name="lang:search.pipeline.stopwords" content="True">
|
||||||
|
|
||||||
|
<meta name="lang:search.pipeline.trimmer" content="True">
|
||||||
|
|
||||||
|
<meta name="lang:search.result.none" content="No matching documents">
|
||||||
|
|
||||||
|
<meta name="lang:search.result.one" content="1 matching document">
|
||||||
|
|
||||||
|
<meta name="lang:search.result.other" content="# matching documents">
|
||||||
|
|
||||||
|
<meta name="lang:search.tokenizer" content="[\s\-]+">
|
||||||
|
|
||||||
|
<link rel="shortcut icon" href="/assets/images/favicon.png">
|
||||||
|
<meta name="generator" content="mkdocs-1.0.4, mkdocs-material-4.2.0">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<title>Yq</title>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="/assets/stylesheets/application.750b69bd.css">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script src="/assets/javascripts/modernizr.74668098.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<link href="https://fonts.gstatic.com" rel="preconnect" crossorigin>
|
||||||
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700|Roboto+Mono">
|
||||||
|
<style>body,input{font-family:"Roboto","Helvetica Neue",Helvetica,Arial,sans-serif}code,kbd,pre{font-family:"Roboto Mono","Courier New",Courier,monospace}</style>
|
||||||
|
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="/assets/fonts/material-icons.css">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body dir="ltr">
|
||||||
|
|
||||||
|
<svg class="md-svg">
|
||||||
|
<defs>
|
||||||
|
|
||||||
|
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="416" height="448"
|
||||||
|
viewBox="0 0 416 448" id="__github">
|
||||||
|
<path fill="currentColor" d="M160 304q0 10-3.125 20.5t-10.75 19-18.125
|
||||||
|
8.5-18.125-8.5-10.75-19-3.125-20.5 3.125-20.5 10.75-19 18.125-8.5
|
||||||
|
18.125 8.5 10.75 19 3.125 20.5zM320 304q0 10-3.125 20.5t-10.75
|
||||||
|
19-18.125 8.5-18.125-8.5-10.75-19-3.125-20.5 3.125-20.5 10.75-19
|
||||||
|
18.125-8.5 18.125 8.5 10.75 19 3.125 20.5zM360
|
||||||
|
304q0-30-17.25-51t-46.75-21q-10.25 0-48.75 5.25-17.75 2.75-39.25
|
||||||
|
2.75t-39.25-2.75q-38-5.25-48.75-5.25-29.5 0-46.75 21t-17.25 51q0 22 8
|
||||||
|
38.375t20.25 25.75 30.5 15 35 7.375 37.25 1.75h42q20.5 0
|
||||||
|
37.25-1.75t35-7.375 30.5-15 20.25-25.75 8-38.375zM416 260q0 51.75-15.25
|
||||||
|
82.75-9.5 19.25-26.375 33.25t-35.25 21.5-42.5 11.875-42.875 5.5-41.75
|
||||||
|
1.125q-19.5 0-35.5-0.75t-36.875-3.125-38.125-7.5-34.25-12.875-30.25-20.25-21.5-28.75q-15.5-30.75-15.5-82.75
|
||||||
|
0-59.25 34-99-6.75-20.5-6.75-42.5 0-29 12.75-54.5 27 0 47.5 9.875t47.25
|
||||||
|
30.875q36.75-8.75 77.25-8.75 37 0 70 8 26.25-20.5
|
||||||
|
46.75-30.25t47.25-9.75q12.75 25.5 12.75 54.5 0 21.75-6.75 42 34 40 34
|
||||||
|
99.5z" />
|
||||||
|
</svg>
|
||||||
|
|
||||||
|
</defs>
|
||||||
|
</svg>
|
||||||
|
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
|
||||||
|
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
|
||||||
|
<label class="md-overlay" data-md-component="overlay" for="__drawer"></label>
|
||||||
|
|
||||||
|
|
||||||
|
<header class="md-header" data-md-component="header">
|
||||||
|
<nav class="md-header-nav md-grid">
|
||||||
|
<div class="md-flex">
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<a href="/." title="Yq" class="md-header-nav__button md-logo">
|
||||||
|
|
||||||
|
<i class="md-icon"></i>
|
||||||
|
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<label class="md-icon md-icon--menu md-header-nav__button" for="__drawer"></label>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--stretch">
|
||||||
|
<div class="md-flex__ellipsis md-header-nav__title" data-md-component="title">
|
||||||
|
|
||||||
|
<span class="md-header-nav__topic">
|
||||||
|
Yq
|
||||||
|
</span>
|
||||||
|
<span class="md-header-nav__topic">
|
||||||
|
|
||||||
|
</span>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
|
||||||
|
<label class="md-icon md-icon--search md-header-nav__button" for="__search"></label>
|
||||||
|
|
||||||
|
<div class="md-search" data-md-component="search" role="dialog">
|
||||||
|
<label class="md-search__overlay" for="__search"></label>
|
||||||
|
<div class="md-search__inner" role="search">
|
||||||
|
<form class="md-search__form" name="search">
|
||||||
|
<input type="text" class="md-search__input" name="query" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="query" data-md-state="active">
|
||||||
|
<label class="md-icon md-search__icon" for="__search"></label>
|
||||||
|
<button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1">
|
||||||
|

|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
<div class="md-search__output">
|
||||||
|
<div class="md-search__scrollwrap" data-md-scrollfix>
|
||||||
|
<div class="md-search-result" data-md-component="result">
|
||||||
|
<div class="md-search-result__meta">
|
||||||
|
Type to start searching
|
||||||
|
</div>
|
||||||
|
<ol class="md-search-result__list"></ol>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<div class="md-header-nav__source">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a href="https://github.com/mikefarah/yq/" title="Go to repository" class="md-source" data-md-source="github">
|
||||||
|
|
||||||
|
<div class="md-source__icon">
|
||||||
|
<svg viewBox="0 0 24 24" width="24" height="24">
|
||||||
|
<use xlink:href="#__github" width="24" height="24"></use>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-source__repository">
|
||||||
|
mikefarah/yq
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="md-container">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<main class="md-main">
|
||||||
|
<div class="md-main__inner md-grid" data-md-component="container">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
|
||||||
|
<div class="md-sidebar__scrollwrap">
|
||||||
|
<div class="md-sidebar__inner">
|
||||||
|
<nav class="md-nav md-nav--primary" data-md-level="0">
|
||||||
|
<label class="md-nav__title md-nav__title--site" for="__drawer">
|
||||||
|
<a href="/." title="Yq" class="md-nav__button md-logo">
|
||||||
|
|
||||||
|
<i class="md-icon"></i>
|
||||||
|
|
||||||
|
</a>
|
||||||
|
Yq
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<div class="md-nav__source">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a href="https://github.com/mikefarah/yq/" title="Go to repository" class="md-source" data-md-source="github">
|
||||||
|
|
||||||
|
<div class="md-source__icon">
|
||||||
|
<svg viewBox="0 0 24 24" width="24" height="24">
|
||||||
|
<use xlink:href="#__github" width="24" height="24"></use>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-source__repository">
|
||||||
|
mikefarah/yq
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ul class="md-nav__list" data-md-scrollfix>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="/." title="Install" class="md-nav__link">
|
||||||
|
Install
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="/read/" title="Read" class="md-nav__link">
|
||||||
|
Read
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="/write/" title="Write/Update" class="md-nav__link">
|
||||||
|
Write/Update
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="/prefix/" title="Prefix" class="md-nav__link">
|
||||||
|
Prefix
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="/delete/" title="Delete" class="md-nav__link">
|
||||||
|
Delete
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="/create/" title="Create" class="md-nav__link">
|
||||||
|
Create
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="/convert/" title="Convert" class="md-nav__link">
|
||||||
|
Convert
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="/merge/" title="Merge" class="md-nav__link">
|
||||||
|
Merge
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="md-content">
|
||||||
|
<article class="md-content__inner md-typeset">
|
||||||
|
|
||||||
|
<h1>404 - Not found</h1>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
|
||||||
|
<footer class="md-footer">
|
||||||
|
|
||||||
|
<div class="md-footer-meta md-typeset">
|
||||||
|
<div class="md-footer-meta__inner md-grid">
|
||||||
|
<div class="md-footer-copyright">
|
||||||
|
|
||||||
|
powered by
|
||||||
|
<a href="https://www.mkdocs.org">MkDocs</a>
|
||||||
|
and
|
||||||
|
<a href="https://squidfunk.github.io/mkdocs-material/">
|
||||||
|
Material for MkDocs</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-footer-social">
|
||||||
|
<link rel="stylesheet" href="/assets/fonts/font-awesome.css">
|
||||||
|
|
||||||
|
<a href="https://github.com/mikefarah" class="md-footer-social__link fa fa-github"></a>
|
||||||
|
|
||||||
|
<a href="https://www.linkedin.com/in/mike-farah-b5a75b2/" class="md-footer-social__link fa fa-linkedin"></a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="/assets/javascripts/application.39abc4af.js"></script>
|
||||||
|
|
||||||
|
<script>app.initialize({version:"1.0.4",url:{base:"/"}})</script>
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
4
docs/assets/fonts/font-awesome.css
vendored
Normal file
4
docs/assets/fonts/font-awesome.css
vendored
Normal file
File diff suppressed because one or more lines are too long
13
docs/assets/fonts/material-icons.css
Normal file
13
docs/assets/fonts/material-icons.css
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
/*!
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy
|
||||||
|
* of the License at:
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING, SOFTWARE
|
||||||
|
* DISTRIBUTED UNDER THE LICENSE IS DISTRIBUTED ON AN "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
* SEE THE LICENSE FOR THE SPECIFIC LANGUAGE GOVERNING PERMISSIONS AND
|
||||||
|
* LIMITATIONS UNDER THE LICENSE.
|
||||||
|
*/@font-face{font-family:"Material Icons";font-style:normal;font-weight:400;src:local("Material Icons"),local("MaterialIcons-Regular"),url("specimen/MaterialIcons-Regular.woff2") format("woff2"),url("specimen/MaterialIcons-Regular.woff") format("woff"),url("specimen/MaterialIcons-Regular.ttf") format("truetype")}
|
||||||
BIN
docs/assets/fonts/specimen/FontAwesome.ttf
Normal file
BIN
docs/assets/fonts/specimen/FontAwesome.ttf
Normal file
Binary file not shown.
BIN
docs/assets/fonts/specimen/FontAwesome.woff
Normal file
BIN
docs/assets/fonts/specimen/FontAwesome.woff
Normal file
Binary file not shown.
BIN
docs/assets/fonts/specimen/FontAwesome.woff2
Normal file
BIN
docs/assets/fonts/specimen/FontAwesome.woff2
Normal file
Binary file not shown.
BIN
docs/assets/fonts/specimen/MaterialIcons-Regular.ttf
Normal file
BIN
docs/assets/fonts/specimen/MaterialIcons-Regular.ttf
Normal file
Binary file not shown.
BIN
docs/assets/fonts/specimen/MaterialIcons-Regular.woff
Normal file
BIN
docs/assets/fonts/specimen/MaterialIcons-Regular.woff
Normal file
Binary file not shown.
BIN
docs/assets/fonts/specimen/MaterialIcons-Regular.woff2
Normal file
BIN
docs/assets/fonts/specimen/MaterialIcons-Regular.woff2
Normal file
Binary file not shown.
BIN
docs/assets/images/favicon.png
Normal file
BIN
docs/assets/images/favicon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 521 B |
20
docs/assets/images/icons/bitbucket.1b09e088.svg
Normal file
20
docs/assets/images/icons/bitbucket.1b09e088.svg
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="352" height="448"
|
||||||
|
viewBox="0 0 352 448" id="__bitbucket">
|
||||||
|
<path fill="currentColor" d="M203.75 214.75q2 15.75-12.625 25.25t-27.875
|
||||||
|
1.5q-9.75-4.25-13.375-14.5t-0.125-20.5 13-14.5q9-4.5 18.125-3t16 8.875
|
||||||
|
6.875 16.875zM231.5 209.5q-3.5-26.75-28.25-41t-49.25-3.25q-15.75
|
||||||
|
7-25.125 22.125t-8.625 32.375q1 22.75 19.375 38.75t41.375 14q22.75-2
|
||||||
|
38-21t12.5-42zM291.25
|
||||||
|
74q-5-6.75-14-11.125t-14.5-5.5-17.75-3.125q-72.75-11.75-141.5 0.5-10.75
|
||||||
|
1.75-16.5 3t-13.75 5.5-12.5 10.75q7.5 7 19 11.375t18.375 5.5 21.875
|
||||||
|
2.875q57 7.25 112 0.25 15.75-2 22.375-3t18.125-5.375 18.75-11.625zM305.5
|
||||||
|
332.75q-2 6.5-3.875 19.125t-3.5 21-7.125 17.5-14.5 14.125q-21.5
|
||||||
|
12-47.375 17.875t-50.5 5.5-50.375-4.625q-11.5-2-20.375-4.5t-19.125-6.75-18.25-10.875-13-15.375q-6.25-24-14.25-73l1.5-4
|
||||||
|
4.5-2.25q55.75 37 126.625 37t126.875-37q5.25 1.5 6 5.75t-1.25 11.25-2
|
||||||
|
9.25zM350.75 92.5q-6.5 41.75-27.75 163.75-1.25 7.5-6.75 14t-10.875
|
||||||
|
10-13.625 7.75q-63 31.5-152.5
|
||||||
|
22-62-6.75-98.5-34.75-3.75-3-6.375-6.625t-4.25-8.75-2.25-8.5-1.5-9.875-1.375-8.75q-2.25-12.5-6.625-37.5t-7-40.375-5.875-36.875-5.5-39.5q0.75-6.5
|
||||||
|
4.375-12.125t7.875-9.375 11.25-7.5 11.5-5.625 12-4.625q31.25-11.5
|
||||||
|
78.25-16 94.75-9.25 169 12.5 38.75 11.5 53.75 30.5 4 5 4.125
|
||||||
|
12.75t-1.375 13.5z" />
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 1.4 KiB |
18
docs/assets/images/icons/github.f0b8504a.svg
Normal file
18
docs/assets/images/icons/github.f0b8504a.svg
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="416" height="448"
|
||||||
|
viewBox="0 0 416 448" id="__github">
|
||||||
|
<path fill="currentColor" d="M160 304q0 10-3.125 20.5t-10.75 19-18.125
|
||||||
|
8.5-18.125-8.5-10.75-19-3.125-20.5 3.125-20.5 10.75-19 18.125-8.5
|
||||||
|
18.125 8.5 10.75 19 3.125 20.5zM320 304q0 10-3.125 20.5t-10.75
|
||||||
|
19-18.125 8.5-18.125-8.5-10.75-19-3.125-20.5 3.125-20.5 10.75-19
|
||||||
|
18.125-8.5 18.125 8.5 10.75 19 3.125 20.5zM360
|
||||||
|
304q0-30-17.25-51t-46.75-21q-10.25 0-48.75 5.25-17.75 2.75-39.25
|
||||||
|
2.75t-39.25-2.75q-38-5.25-48.75-5.25-29.5 0-46.75 21t-17.25 51q0 22 8
|
||||||
|
38.375t20.25 25.75 30.5 15 35 7.375 37.25 1.75h42q20.5 0
|
||||||
|
37.25-1.75t35-7.375 30.5-15 20.25-25.75 8-38.375zM416 260q0 51.75-15.25
|
||||||
|
82.75-9.5 19.25-26.375 33.25t-35.25 21.5-42.5 11.875-42.875 5.5-41.75
|
||||||
|
1.125q-19.5 0-35.5-0.75t-36.875-3.125-38.125-7.5-34.25-12.875-30.25-20.25-21.5-28.75q-15.5-30.75-15.5-82.75
|
||||||
|
0-59.25 34-99-6.75-20.5-6.75-42.5 0-29 12.75-54.5 27 0 47.5 9.875t47.25
|
||||||
|
30.875q36.75-8.75 77.25-8.75 37 0 70 8 26.25-20.5
|
||||||
|
46.75-30.25t47.25-9.75q12.75 25.5 12.75 54.5 0 21.75-6.75 42 34 40 34
|
||||||
|
99.5z" />
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 1.2 KiB |
38
docs/assets/images/icons/gitlab.6dd19c00.svg
Normal file
38
docs/assets/images/icons/gitlab.6dd19c00.svg
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="500" height="500"
|
||||||
|
viewBox="0 0 500 500" id="__gitlab">
|
||||||
|
<g transform="translate(156.197863, 1.160267)">
|
||||||
|
<path fill="currentColor"
|
||||||
|
d="M93.667,473.347L93.667,473.347l90.684-279.097H2.983L93.667,
|
||||||
|
473.347L93.667,473.347z" />
|
||||||
|
</g>
|
||||||
|
<g transform="translate(28.531199, 1.160800)" opacity="0.7">
|
||||||
|
<path fill="currentColor"
|
||||||
|
d="M221.333,473.345L130.649,194.25H3.557L221.333,473.345L221.333,
|
||||||
|
473.345z" />
|
||||||
|
</g>
|
||||||
|
<g transform="translate(0.088533, 0.255867)" opacity="0.5">
|
||||||
|
<path fill="currentColor"
|
||||||
|
d="M32,195.155L32,195.155L4.441,279.97c-2.513,7.735,0.24,16.21,6.821,
|
||||||
|
20.99l238.514,173.29 L32,195.155L32,195.155z" />
|
||||||
|
</g>
|
||||||
|
<g transform="translate(29.421866, 280.255593)">
|
||||||
|
<path fill="currentColor"
|
||||||
|
d="M2.667-84.844h127.092L75.14-252.942c-2.811-8.649-15.047-8.649-17.856,
|
||||||
|
0L2.667-84.844 L2.667-84.844z" />
|
||||||
|
</g>
|
||||||
|
<g transform="translate(247.197860, 1.160800)" opacity="0.7">
|
||||||
|
<path fill="currentColor"
|
||||||
|
d="M2.667,473.345L93.351,194.25h127.092L2.667,473.345L2.667,
|
||||||
|
473.345z" />
|
||||||
|
</g>
|
||||||
|
<g transform="translate(246.307061, 0.255867)" opacity="0.5">
|
||||||
|
<path fill="currentColor"
|
||||||
|
d="M221.334,195.155L221.334,195.155l27.559,84.815c2.514,7.735-0.24,
|
||||||
|
16.21-6.821,20.99 L3.557,474.25L221.334,195.155L221.334,195.155z" />
|
||||||
|
</g>
|
||||||
|
<g transform="translate(336.973725, 280.255593)">
|
||||||
|
<path fill="currentColor"
|
||||||
|
d="M130.667-84.844H3.575l54.618-168.098c2.811-8.649,15.047-8.649,
|
||||||
|
17.856,0L130.667-84.844 L130.667-84.844z" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 1.6 KiB |
6
docs/assets/javascripts/application.39abc4af.js
Normal file
6
docs/assets/javascripts/application.39abc4af.js
Normal file
File diff suppressed because one or more lines are too long
1
docs/assets/javascripts/lunr/lunr.da.js
Normal file
1
docs/assets/javascripts/lunr/lunr.da.js
Normal file
@@ -0,0 +1 @@
|
|||||||
|
!function(e,r){"function"==typeof define&&define.amd?define(r):"object"==typeof exports?module.exports=r():r()(e.lunr)}(this,function(){return function(e){if(void 0===e)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if(void 0===e.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");var r,m,i;e.da=function(){this.pipeline.reset(),this.pipeline.add(e.da.trimmer,e.da.stopWordFilter,e.da.stemmer),this.searchPipeline&&(this.searchPipeline.reset(),this.searchPipeline.add(e.da.stemmer))},e.da.wordCharacters="A-Za-zªºÀ-ÖØ-öø-ʸˠ-ˤᴀ-ᴥᴬ-ᵜᵢ-ᵥᵫ-ᵷᵹ-ᶾḀ-ỿⁱⁿₐ-ₜKÅℲⅎⅠ-ↈⱠ-ⱿꜢ-ꞇꞋ-ꞭꞰ-ꞷꟷ-ꟿꬰ-ꭚꭜ-ꭤff-stA-Za-z",e.da.trimmer=e.trimmerSupport.generateTrimmer(e.da.wordCharacters),e.Pipeline.registerFunction(e.da.trimmer,"trimmer-da"),e.da.stemmer=(r=e.stemmerSupport.Among,m=e.stemmerSupport.SnowballProgram,i=new function(){var i,t,n,s=[new r("hed",-1,1),new r("ethed",0,1),new r("ered",-1,1),new r("e",-1,1),new r("erede",3,1),new r("ende",3,1),new r("erende",5,1),new r("ene",3,1),new r("erne",3,1),new r("ere",3,1),new r("en",-1,1),new r("heden",10,1),new r("eren",10,1),new r("er",-1,1),new r("heder",13,1),new r("erer",13,1),new r("s",-1,2),new r("heds",16,1),new r("es",16,1),new r("endes",18,1),new r("erendes",19,1),new r("enes",18,1),new r("ernes",18,1),new r("eres",18,1),new r("ens",16,1),new r("hedens",24,1),new r("erens",24,1),new r("ers",16,1),new r("ets",16,1),new r("erets",28,1),new r("et",-1,1),new r("eret",30,1)],o=[new r("gd",-1,-1),new r("dt",-1,-1),new r("gt",-1,-1),new r("kt",-1,-1)],a=[new r("ig",-1,1),new r("lig",0,1),new r("elig",1,1),new r("els",-1,1),new r("løst",-1,2)],d=[17,65,16,1,0,0,0,0,0,0,0,0,0,0,0,0,48,0,128],u=[239,254,42,3,0,0,0,0,0,0,0,0,0,0,0,0,16],c=new m;function l(){var e,r=c.limit-c.cursor;c.cursor>=t&&(e=c.limit_backward,c.limit_backward=t,c.ket=c.cursor,c.find_among_b(o,4)?(c.bra=c.cursor,c.limit_backward=e,c.cursor=c.limit-r,c.cursor>c.limit_backward&&(c.cursor--,c.bra=c.cursor,c.slice_del())):c.limit_backward=e)}this.setCurrent=function(e){c.setCurrent(e)},this.getCurrent=function(){return c.getCurrent()},this.stem=function(){var e,r=c.cursor;return function(){var e,r=c.cursor+3;if(t=c.limit,0<=r&&r<=c.limit){for(i=r;;){if(e=c.cursor,c.in_grouping(d,97,248)){c.cursor=e;break}if((c.cursor=e)>=c.limit)return;c.cursor++}for(;!c.out_grouping(d,97,248);){if(c.cursor>=c.limit)return;c.cursor++}(t=c.cursor)<i&&(t=i)}}(),c.limit_backward=r,c.cursor=c.limit,function(){var e,r;if(c.cursor>=t&&(r=c.limit_backward,c.limit_backward=t,c.ket=c.cursor,e=c.find_among_b(s,32),c.limit_backward=r,e))switch(c.bra=c.cursor,e){case 1:c.slice_del();break;case 2:c.in_grouping_b(u,97,229)&&c.slice_del()}}(),c.cursor=c.limit,l(),c.cursor=c.limit,function(){var e,r,i,n=c.limit-c.cursor;if(c.ket=c.cursor,c.eq_s_b(2,"st")&&(c.bra=c.cursor,c.eq_s_b(2,"ig")&&c.slice_del()),c.cursor=c.limit-n,c.cursor>=t&&(r=c.limit_backward,c.limit_backward=t,c.ket=c.cursor,e=c.find_among_b(a,5),c.limit_backward=r,e))switch(c.bra=c.cursor,e){case 1:c.slice_del(),i=c.limit-c.cursor,l(),c.cursor=c.limit-i;break;case 2:c.slice_from("løs")}}(),c.cursor=c.limit,c.cursor>=t&&(e=c.limit_backward,c.limit_backward=t,c.ket=c.cursor,c.out_grouping_b(d,97,248)?(c.bra=c.cursor,n=c.slice_to(n),c.limit_backward=e,c.eq_v_b(n)&&c.slice_del()):c.limit_backward=e),!0}},function(e){return"function"==typeof e.update?e.update(function(e){return i.setCurrent(e),i.stem(),i.getCurrent()}):(i.setCurrent(e),i.stem(),i.getCurrent())}),e.Pipeline.registerFunction(e.da.stemmer,"stemmer-da"),e.da.stopWordFilter=e.generateStopWordFilter("ad af alle alt anden at blev blive bliver da de dem den denne der deres det dette dig din disse dog du efter eller en end er et for fra ham han hans har havde have hende hendes her hos hun hvad hvis hvor i ikke ind jeg jer jo kunne man mange med meget men mig min mine mit mod ned noget nogle nu når og også om op os over på selv sig sin sine sit skal skulle som sådan thi til ud under var vi vil ville vor være været".split(" ")),e.Pipeline.registerFunction(e.da.stopWordFilter,"stopWordFilter-da")}});
|
||||||
1
docs/assets/javascripts/lunr/lunr.de.js
Normal file
1
docs/assets/javascripts/lunr/lunr.de.js
Normal file
File diff suppressed because one or more lines are too long
1
docs/assets/javascripts/lunr/lunr.du.js
Normal file
1
docs/assets/javascripts/lunr/lunr.du.js
Normal file
File diff suppressed because one or more lines are too long
1
docs/assets/javascripts/lunr/lunr.es.js
Normal file
1
docs/assets/javascripts/lunr/lunr.es.js
Normal file
File diff suppressed because one or more lines are too long
1
docs/assets/javascripts/lunr/lunr.fi.js
Normal file
1
docs/assets/javascripts/lunr/lunr.fi.js
Normal file
File diff suppressed because one or more lines are too long
1
docs/assets/javascripts/lunr/lunr.fr.js
Normal file
1
docs/assets/javascripts/lunr/lunr.fr.js
Normal file
File diff suppressed because one or more lines are too long
1
docs/assets/javascripts/lunr/lunr.hu.js
Normal file
1
docs/assets/javascripts/lunr/lunr.hu.js
Normal file
File diff suppressed because one or more lines are too long
1
docs/assets/javascripts/lunr/lunr.it.js
Normal file
1
docs/assets/javascripts/lunr/lunr.it.js
Normal file
File diff suppressed because one or more lines are too long
1
docs/assets/javascripts/lunr/lunr.ja.js
Normal file
1
docs/assets/javascripts/lunr/lunr.ja.js
Normal file
@@ -0,0 +1 @@
|
|||||||
|
!function(e,r){"function"==typeof define&&define.amd?define(r):"object"==typeof exports?module.exports=r():r()(e.lunr)}(this,function(){return function(m){if(void 0===m)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if(void 0===m.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");var l="2"==m.version[0];m.ja=function(){this.pipeline.reset(),this.pipeline.add(m.ja.trimmer,m.ja.stopWordFilter,m.ja.stemmer),l?this.tokenizer=m.ja.tokenizer:(m.tokenizer&&(m.tokenizer=m.ja.tokenizer),this.tokenizerFn&&(this.tokenizerFn=m.ja.tokenizer))};var j=new m.TinySegmenter;m.ja.tokenizer=function(e){var r,t,i,n,o,s,p,a,u;if(!arguments.length||null==e||null==e)return[];if(Array.isArray(e))return e.map(function(e){return l?new m.Token(e.toLowerCase()):e.toLowerCase()});for(r=(t=e.toString().toLowerCase().replace(/^\s+/,"")).length-1;0<=r;r--)if(/\S/.test(t.charAt(r))){t=t.substring(0,r+1);break}for(o=[],i=t.length,p=a=0;a<=i;a++)if(s=a-p,t.charAt(a).match(/\s/)||a==i){if(0<s)for(n=j.segment(t.slice(p,a)).filter(function(e){return!!e}),u=p,r=0;r<n.length;r++)l?o.push(new m.Token(n[r],{position:[u,n[r].length],index:o.length})):o.push(n[r]),u+=n[r].length;p=a+1}return o},m.ja.stemmer=function(e){return e},m.Pipeline.registerFunction(m.ja.stemmer,"stemmer-ja"),m.ja.wordCharacters="一二三四五六七八九十百千万億兆一-龠々〆ヵヶぁ-んァ-ヴーア-ン゙a-zA-Za-zA-Z0-90-9",m.ja.trimmer=m.trimmerSupport.generateTrimmer(m.ja.wordCharacters),m.Pipeline.registerFunction(m.ja.trimmer,"trimmer-ja"),m.ja.stopWordFilter=m.generateStopWordFilter("これ それ あれ この その あの ここ そこ あそこ こちら どこ だれ なに なん 何 私 貴方 貴方方 我々 私達 あの人 あのかた 彼女 彼 です あります おります います は が の に を で え から まで より も どの と し それで しかし".split(" ")),m.Pipeline.registerFunction(m.ja.stopWordFilter,"stopWordFilter-ja"),m.jp=m.ja,m.Pipeline.registerFunction(m.jp.stemmer,"stemmer-jp"),m.Pipeline.registerFunction(m.jp.trimmer,"trimmer-jp"),m.Pipeline.registerFunction(m.jp.stopWordFilter,"stopWordFilter-jp")}});
|
||||||
1
docs/assets/javascripts/lunr/lunr.jp.js
Normal file
1
docs/assets/javascripts/lunr/lunr.jp.js
Normal file
@@ -0,0 +1 @@
|
|||||||
|
module.exports=require("./lunr.ja");
|
||||||
1
docs/assets/javascripts/lunr/lunr.multi.js
Normal file
1
docs/assets/javascripts/lunr/lunr.multi.js
Normal file
@@ -0,0 +1 @@
|
|||||||
|
!function(e,i){"function"==typeof define&&define.amd?define(i):"object"==typeof exports?module.exports=i():i()(e.lunr)}(this,function(){return function(o){o.multiLanguage=function(){for(var e=Array.prototype.slice.call(arguments),i=e.join("-"),t="",r=[],n=[],s=0;s<e.length;++s)"en"==e[s]?(t+="\\w",r.unshift(o.stopWordFilter),r.push(o.stemmer),n.push(o.stemmer)):(t+=o[e[s]].wordCharacters,r.unshift(o[e[s]].stopWordFilter),r.push(o[e[s]].stemmer),n.push(o[e[s]].stemmer));var p=o.trimmerSupport.generateTrimmer(t);return o.Pipeline.registerFunction(p,"lunr-multi-trimmer-"+i),r.unshift(p),function(){this.pipeline.reset(),this.pipeline.add.apply(this.pipeline,r),this.searchPipeline&&(this.searchPipeline.reset(),this.searchPipeline.add.apply(this.searchPipeline,n))}}}});
|
||||||
1
docs/assets/javascripts/lunr/lunr.nl.js
Normal file
1
docs/assets/javascripts/lunr/lunr.nl.js
Normal file
File diff suppressed because one or more lines are too long
1
docs/assets/javascripts/lunr/lunr.no.js
Normal file
1
docs/assets/javascripts/lunr/lunr.no.js
Normal file
@@ -0,0 +1 @@
|
|||||||
|
!function(e,r){"function"==typeof define&&define.amd?define(r):"object"==typeof exports?module.exports=r():r()(e.lunr)}(this,function(){return function(e){if(void 0===e)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if(void 0===e.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");var r,n,i;e.no=function(){this.pipeline.reset(),this.pipeline.add(e.no.trimmer,e.no.stopWordFilter,e.no.stemmer),this.searchPipeline&&(this.searchPipeline.reset(),this.searchPipeline.add(e.no.stemmer))},e.no.wordCharacters="A-Za-zªºÀ-ÖØ-öø-ʸˠ-ˤᴀ-ᴥᴬ-ᵜᵢ-ᵥᵫ-ᵷᵹ-ᶾḀ-ỿⁱⁿₐ-ₜKÅℲⅎⅠ-ↈⱠ-ⱿꜢ-ꞇꞋ-ꞭꞰ-ꞷꟷ-ꟿꬰ-ꭚꭜ-ꭤff-stA-Za-z",e.no.trimmer=e.trimmerSupport.generateTrimmer(e.no.wordCharacters),e.Pipeline.registerFunction(e.no.trimmer,"trimmer-no"),e.no.stemmer=(r=e.stemmerSupport.Among,n=e.stemmerSupport.SnowballProgram,i=new function(){var o,s,a=[new r("a",-1,1),new r("e",-1,1),new r("ede",1,1),new r("ande",1,1),new r("ende",1,1),new r("ane",1,1),new r("ene",1,1),new r("hetene",6,1),new r("erte",1,3),new r("en",-1,1),new r("heten",9,1),new r("ar",-1,1),new r("er",-1,1),new r("heter",12,1),new r("s",-1,2),new r("as",14,1),new r("es",14,1),new r("edes",16,1),new r("endes",16,1),new r("enes",16,1),new r("hetenes",19,1),new r("ens",14,1),new r("hetens",21,1),new r("ers",14,1),new r("ets",14,1),new r("et",-1,1),new r("het",25,1),new r("ert",-1,3),new r("ast",-1,1)],m=[new r("dt",-1,-1),new r("vt",-1,-1)],l=[new r("leg",-1,1),new r("eleg",0,1),new r("ig",-1,1),new r("eig",2,1),new r("lig",2,1),new r("elig",4,1),new r("els",-1,1),new r("lov",-1,1),new r("elov",7,1),new r("slov",7,1),new r("hetslov",9,1)],u=[17,65,16,1,0,0,0,0,0,0,0,0,0,0,0,0,48,0,128],d=[119,125,149,1],c=new n;this.setCurrent=function(e){c.setCurrent(e)},this.getCurrent=function(){return c.getCurrent()},this.stem=function(){var e,r,n,i,t=c.cursor;return function(){var e,r=c.cursor+3;if(s=c.limit,0<=r||r<=c.limit){for(o=r;;){if(e=c.cursor,c.in_grouping(u,97,248)){c.cursor=e;break}if(e>=c.limit)return;c.cursor=e+1}for(;!c.out_grouping(u,97,248);){if(c.cursor>=c.limit)return;c.cursor++}(s=c.cursor)<o&&(s=o)}}(),c.limit_backward=t,c.cursor=c.limit,function(){var e,r,n;if(c.cursor>=s&&(r=c.limit_backward,c.limit_backward=s,c.ket=c.cursor,e=c.find_among_b(a,29),c.limit_backward=r,e))switch(c.bra=c.cursor,e){case 1:c.slice_del();break;case 2:n=c.limit-c.cursor,c.in_grouping_b(d,98,122)?c.slice_del():(c.cursor=c.limit-n,c.eq_s_b(1,"k")&&c.out_grouping_b(u,97,248)&&c.slice_del());break;case 3:c.slice_from("er")}}(),c.cursor=c.limit,r=c.limit-c.cursor,c.cursor>=s&&(e=c.limit_backward,c.limit_backward=s,c.ket=c.cursor,c.find_among_b(m,2)?(c.bra=c.cursor,c.limit_backward=e,c.cursor=c.limit-r,c.cursor>c.limit_backward&&(c.cursor--,c.bra=c.cursor,c.slice_del())):c.limit_backward=e),c.cursor=c.limit,c.cursor>=s&&(i=c.limit_backward,c.limit_backward=s,c.ket=c.cursor,(n=c.find_among_b(l,11))?(c.bra=c.cursor,c.limit_backward=i,1==n&&c.slice_del()):c.limit_backward=i),!0}},function(e){return"function"==typeof e.update?e.update(function(e){return i.setCurrent(e),i.stem(),i.getCurrent()}):(i.setCurrent(e),i.stem(),i.getCurrent())}),e.Pipeline.registerFunction(e.no.stemmer,"stemmer-no"),e.no.stopWordFilter=e.generateStopWordFilter("alle at av bare begge ble blei bli blir blitt både båe da de deg dei deim deira deires dem den denne der dere deres det dette di din disse ditt du dykk dykkar då eg ein eit eitt eller elles en enn er et ett etter for fordi fra før ha hadde han hans har hennar henne hennes her hjå ho hoe honom hoss hossen hun hva hvem hver hvilke hvilken hvis hvor hvordan hvorfor i ikke ikkje ikkje ingen ingi inkje inn inni ja jeg kan kom korleis korso kun kunne kva kvar kvarhelst kven kvi kvifor man mange me med medan meg meget mellom men mi min mine mitt mot mykje ned no noe noen noka noko nokon nokor nokre nå når og også om opp oss over på samme seg selv si si sia sidan siden sin sine sitt sjøl skal skulle slik so som som somme somt så sånn til um upp ut uten var vart varte ved vere verte vi vil ville vore vors vort vår være være vært å".split(" ")),e.Pipeline.registerFunction(e.no.stopWordFilter,"stopWordFilter-no")}});
|
||||||
1
docs/assets/javascripts/lunr/lunr.pt.js
Normal file
1
docs/assets/javascripts/lunr/lunr.pt.js
Normal file
File diff suppressed because one or more lines are too long
1
docs/assets/javascripts/lunr/lunr.ro.js
Normal file
1
docs/assets/javascripts/lunr/lunr.ro.js
Normal file
File diff suppressed because one or more lines are too long
1
docs/assets/javascripts/lunr/lunr.ru.js
Normal file
1
docs/assets/javascripts/lunr/lunr.ru.js
Normal file
File diff suppressed because one or more lines are too long
1
docs/assets/javascripts/lunr/lunr.stemmer.support.js
Normal file
1
docs/assets/javascripts/lunr/lunr.stemmer.support.js
Normal file
@@ -0,0 +1 @@
|
|||||||
|
!function(r,t){"function"==typeof define&&define.amd?define(t):"object"==typeof exports?module.exports=t():t()(r.lunr)}(this,function(){return function(r){r.stemmerSupport={Among:function(r,t,i,s){if(this.toCharArray=function(r){for(var t=r.length,i=new Array(t),s=0;s<t;s++)i[s]=r.charCodeAt(s);return i},!r&&""!=r||!t&&0!=t||!i)throw"Bad Among initialisation: s:"+r+", substring_i: "+t+", result: "+i;this.s_size=r.length,this.s=this.toCharArray(r),this.substring_i=t,this.result=i,this.method=s},SnowballProgram:function(){var b;return{bra:0,ket:0,limit:0,cursor:0,limit_backward:0,setCurrent:function(r){b=r,this.cursor=0,this.limit=r.length,this.limit_backward=0,this.bra=this.cursor,this.ket=this.limit},getCurrent:function(){var r=b;return b=null,r},in_grouping:function(r,t,i){if(this.cursor<this.limit){var s=b.charCodeAt(this.cursor);if(s<=i&&t<=s&&r[(s-=t)>>3]&1<<(7&s))return this.cursor++,!0}return!1},in_grouping_b:function(r,t,i){if(this.cursor>this.limit_backward){var s=b.charCodeAt(this.cursor-1);if(s<=i&&t<=s&&r[(s-=t)>>3]&1<<(7&s))return this.cursor--,!0}return!1},out_grouping:function(r,t,i){if(this.cursor<this.limit){var s=b.charCodeAt(this.cursor);if(i<s||s<t)return this.cursor++,!0;if(!(r[(s-=t)>>3]&1<<(7&s)))return this.cursor++,!0}return!1},out_grouping_b:function(r,t,i){if(this.cursor>this.limit_backward){var s=b.charCodeAt(this.cursor-1);if(i<s||s<t)return this.cursor--,!0;if(!(r[(s-=t)>>3]&1<<(7&s)))return this.cursor--,!0}return!1},eq_s:function(r,t){if(this.limit-this.cursor<r)return!1;for(var i=0;i<r;i++)if(b.charCodeAt(this.cursor+i)!=t.charCodeAt(i))return!1;return this.cursor+=r,!0},eq_s_b:function(r,t){if(this.cursor-this.limit_backward<r)return!1;for(var i=0;i<r;i++)if(b.charCodeAt(this.cursor-r+i)!=t.charCodeAt(i))return!1;return this.cursor-=r,!0},find_among:function(r,t){for(var i=0,s=t,e=this.cursor,n=this.limit,u=0,o=0,h=!1;;){for(var c=i+(s-i>>1),a=0,f=u<o?u:o,l=r[c],_=f;_<l.s_size;_++){if(e+f==n){a=-1;break}if(a=b.charCodeAt(e+f)-l.s[_])break;f++}if(a<0?(s=c,o=f):(i=c,u=f),s-i<=1){if(0<i||s==i||h)break;h=!0}}for(;;){if(u>=(l=r[i]).s_size){if(this.cursor=e+l.s_size,!l.method)return l.result;var m=l.method();if(this.cursor=e+l.s_size,m)return l.result}if((i=l.substring_i)<0)return 0}},find_among_b:function(r,t){for(var i=0,s=t,e=this.cursor,n=this.limit_backward,u=0,o=0,h=!1;;){for(var c=i+(s-i>>1),a=0,f=u<o?u:o,l=(_=r[c]).s_size-1-f;0<=l;l--){if(e-f==n){a=-1;break}if(a=b.charCodeAt(e-1-f)-_.s[l])break;f++}if(a<0?(s=c,o=f):(i=c,u=f),s-i<=1){if(0<i||s==i||h)break;h=!0}}for(;;){var _;if(u>=(_=r[i]).s_size){if(this.cursor=e-_.s_size,!_.method)return _.result;var m=_.method();if(this.cursor=e-_.s_size,m)return _.result}if((i=_.substring_i)<0)return 0}},replace_s:function(r,t,i){var s=i.length-(t-r);return b=b.substring(0,r)+i+b.substring(t),this.limit+=s,this.cursor>=t?this.cursor+=s:this.cursor>r&&(this.cursor=r),s},slice_check:function(){if(this.bra<0||this.bra>this.ket||this.ket>this.limit||this.limit>b.length)throw"faulty slice operation"},slice_from:function(r){this.slice_check(),this.replace_s(this.bra,this.ket,r)},slice_del:function(){this.slice_from("")},insert:function(r,t,i){var s=this.replace_s(r,t,i);r<=this.bra&&(this.bra+=s),r<=this.ket&&(this.ket+=s)},slice_to:function(){return this.slice_check(),b.substring(this.bra,this.ket)},eq_v_b:function(r){return this.eq_s_b(r.length,r)}}}},r.trimmerSupport={generateTrimmer:function(r){var t=new RegExp("^[^"+r+"]+"),i=new RegExp("[^"+r+"]+$");return function(r){return"function"==typeof r.update?r.update(function(r){return r.replace(t,"").replace(i,"")}):r.replace(t,"").replace(i,"")}}}}});
|
||||||
1
docs/assets/javascripts/lunr/lunr.sv.js
Normal file
1
docs/assets/javascripts/lunr/lunr.sv.js
Normal file
@@ -0,0 +1 @@
|
|||||||
|
!function(e,r){"function"==typeof define&&define.amd?define(r):"object"==typeof exports?module.exports=r():r()(e.lunr)}(this,function(){return function(e){if(void 0===e)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if(void 0===e.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");var r,l,n;e.sv=function(){this.pipeline.reset(),this.pipeline.add(e.sv.trimmer,e.sv.stopWordFilter,e.sv.stemmer),this.searchPipeline&&(this.searchPipeline.reset(),this.searchPipeline.add(e.sv.stemmer))},e.sv.wordCharacters="A-Za-zªºÀ-ÖØ-öø-ʸˠ-ˤᴀ-ᴥᴬ-ᵜᵢ-ᵥᵫ-ᵷᵹ-ᶾḀ-ỿⁱⁿₐ-ₜKÅℲⅎⅠ-ↈⱠ-ⱿꜢ-ꞇꞋ-ꞭꞰ-ꞷꟷ-ꟿꬰ-ꭚꭜ-ꭤff-stA-Za-z",e.sv.trimmer=e.trimmerSupport.generateTrimmer(e.sv.wordCharacters),e.Pipeline.registerFunction(e.sv.trimmer,"trimmer-sv"),e.sv.stemmer=(r=e.stemmerSupport.Among,l=e.stemmerSupport.SnowballProgram,n=new function(){var n,t,i=[new r("a",-1,1),new r("arna",0,1),new r("erna",0,1),new r("heterna",2,1),new r("orna",0,1),new r("ad",-1,1),new r("e",-1,1),new r("ade",6,1),new r("ande",6,1),new r("arne",6,1),new r("are",6,1),new r("aste",6,1),new r("en",-1,1),new r("anden",12,1),new r("aren",12,1),new r("heten",12,1),new r("ern",-1,1),new r("ar",-1,1),new r("er",-1,1),new r("heter",18,1),new r("or",-1,1),new r("s",-1,2),new r("as",21,1),new r("arnas",22,1),new r("ernas",22,1),new r("ornas",22,1),new r("es",21,1),new r("ades",26,1),new r("andes",26,1),new r("ens",21,1),new r("arens",29,1),new r("hetens",29,1),new r("erns",21,1),new r("at",-1,1),new r("andet",-1,1),new r("het",-1,1),new r("ast",-1,1)],s=[new r("dd",-1,-1),new r("gd",-1,-1),new r("nn",-1,-1),new r("dt",-1,-1),new r("gt",-1,-1),new r("kt",-1,-1),new r("tt",-1,-1)],a=[new r("ig",-1,1),new r("lig",0,1),new r("els",-1,1),new r("fullt",-1,3),new r("löst",-1,2)],o=[17,65,16,1,0,0,0,0,0,0,0,0,0,0,0,0,24,0,32],u=[119,127,149],m=new l;this.setCurrent=function(e){m.setCurrent(e)},this.getCurrent=function(){return m.getCurrent()},this.stem=function(){var e,r=m.cursor;return function(){var e,r=m.cursor+3;if(t=m.limit,0<=r||r<=m.limit){for(n=r;;){if(e=m.cursor,m.in_grouping(o,97,246)){m.cursor=e;break}if(m.cursor=e,m.cursor>=m.limit)return;m.cursor++}for(;!m.out_grouping(o,97,246);){if(m.cursor>=m.limit)return;m.cursor++}(t=m.cursor)<n&&(t=n)}}(),m.limit_backward=r,m.cursor=m.limit,function(){var e,r=m.limit_backward;if(m.cursor>=t&&(m.limit_backward=t,m.cursor=m.limit,m.ket=m.cursor,e=m.find_among_b(i,37),m.limit_backward=r,e))switch(m.bra=m.cursor,e){case 1:m.slice_del();break;case 2:m.in_grouping_b(u,98,121)&&m.slice_del()}}(),m.cursor=m.limit,e=m.limit_backward,m.cursor>=t&&(m.limit_backward=t,m.cursor=m.limit,m.find_among_b(s,7)&&(m.cursor=m.limit,m.ket=m.cursor,m.cursor>m.limit_backward&&(m.bra=--m.cursor,m.slice_del())),m.limit_backward=e),m.cursor=m.limit,function(){var e,r;if(m.cursor>=t){if(r=m.limit_backward,m.limit_backward=t,m.cursor=m.limit,m.ket=m.cursor,e=m.find_among_b(a,5))switch(m.bra=m.cursor,e){case 1:m.slice_del();break;case 2:m.slice_from("lös");break;case 3:m.slice_from("full")}m.limit_backward=r}}(),!0}},function(e){return"function"==typeof e.update?e.update(function(e){return n.setCurrent(e),n.stem(),n.getCurrent()}):(n.setCurrent(e),n.stem(),n.getCurrent())}),e.Pipeline.registerFunction(e.sv.stemmer,"stemmer-sv"),e.sv.stopWordFilter=e.generateStopWordFilter("alla allt att av blev bli blir blivit de dem den denna deras dess dessa det detta dig din dina ditt du där då efter ej eller en er era ert ett från för ha hade han hans har henne hennes hon honom hur här i icke ingen inom inte jag ju kan kunde man med mellan men mig min mina mitt mot mycket ni nu när någon något några och om oss på samma sedan sig sin sina sitta själv skulle som så sådan sådana sådant till under upp ut utan vad var vara varför varit varje vars vart vem vi vid vilka vilkas vilken vilket vår våra vårt än är åt över".split(" ")),e.Pipeline.registerFunction(e.sv.stopWordFilter,"stopWordFilter-sv")}});
|
||||||
1
docs/assets/javascripts/lunr/lunr.th.js
Normal file
1
docs/assets/javascripts/lunr/lunr.th.js
Normal file
@@ -0,0 +1 @@
|
|||||||
|
!function(e,r){"function"==typeof define&&define.amd?define(r):"object"==typeof exports?module.exports=r():r()(e.lunr)}(this,function(){return function(t){if(void 0===t)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if(void 0===t.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");var i="2"==t.version[0];t.th=function(){this.pipeline.reset(),this.pipeline.add(t.th.trimmer),i?this.tokenizer=t.th.tokenizer:(t.tokenizer&&(t.tokenizer=t.th.tokenizer),this.tokenizerFn&&(this.tokenizerFn=t.th.tokenizer))},t.th.wordCharacters="[-]",t.th.trimmer=t.trimmerSupport.generateTrimmer(t.th.wordCharacters),t.Pipeline.registerFunction(t.th.trimmer,"trimmer-th");var n=t.wordcut;n.init(),t.th.tokenizer=function(e){if(!arguments.length||null==e||null==e)return[];if(Array.isArray(e))return e.map(function(e){return i?new t.Token(e):e});var r=e.toString().replace(/^\s+/,"");return n.cut(r).split("|")}}});
|
||||||
1
docs/assets/javascripts/lunr/lunr.tr.js
Normal file
1
docs/assets/javascripts/lunr/lunr.tr.js
Normal file
File diff suppressed because one or more lines are too long
1
docs/assets/javascripts/lunr/tinyseg.js
Normal file
1
docs/assets/javascripts/lunr/tinyseg.js
Normal file
File diff suppressed because one or more lines are too long
1
docs/assets/javascripts/lunr/wordcut.js
Normal file
1
docs/assets/javascripts/lunr/wordcut.js
Normal file
File diff suppressed because one or more lines are too long
1
docs/assets/javascripts/modernizr.74668098.js
Normal file
1
docs/assets/javascripts/modernizr.74668098.js
Normal file
File diff suppressed because one or more lines are too long
1
docs/assets/stylesheets/application-palette.224b79ff.css
Normal file
1
docs/assets/stylesheets/application-palette.224b79ff.css
Normal file
File diff suppressed because one or more lines are too long
1
docs/assets/stylesheets/application.750b69bd.css
Normal file
1
docs/assets/stylesheets/application.750b69bd.css
Normal file
File diff suppressed because one or more lines are too long
533
docs/convert/index.html
Normal file
533
docs/convert/index.html
Normal file
@@ -0,0 +1,533 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="en" class="no-js">
|
||||||
|
<head>
|
||||||
|
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||||
|
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<meta name="lang:clipboard.copy" content="Copy to clipboard">
|
||||||
|
|
||||||
|
<meta name="lang:clipboard.copied" content="Copied to clipboard">
|
||||||
|
|
||||||
|
<meta name="lang:search.language" content="en">
|
||||||
|
|
||||||
|
<meta name="lang:search.pipeline.stopwords" content="True">
|
||||||
|
|
||||||
|
<meta name="lang:search.pipeline.trimmer" content="True">
|
||||||
|
|
||||||
|
<meta name="lang:search.result.none" content="No matching documents">
|
||||||
|
|
||||||
|
<meta name="lang:search.result.one" content="1 matching document">
|
||||||
|
|
||||||
|
<meta name="lang:search.result.other" content="# matching documents">
|
||||||
|
|
||||||
|
<meta name="lang:search.tokenizer" content="[\s\-]+">
|
||||||
|
|
||||||
|
<link rel="shortcut icon" href="../assets/images/favicon.png">
|
||||||
|
<meta name="generator" content="mkdocs-1.0.4, mkdocs-material-4.2.0">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<title>Convert - Yq</title>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="../assets/stylesheets/application.750b69bd.css">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script src="../assets/javascripts/modernizr.74668098.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<link href="https://fonts.gstatic.com" rel="preconnect" crossorigin>
|
||||||
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700|Roboto+Mono">
|
||||||
|
<style>body,input{font-family:"Roboto","Helvetica Neue",Helvetica,Arial,sans-serif}code,kbd,pre{font-family:"Roboto Mono","Courier New",Courier,monospace}</style>
|
||||||
|
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="../assets/fonts/material-icons.css">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body dir="ltr">
|
||||||
|
|
||||||
|
<svg class="md-svg">
|
||||||
|
<defs>
|
||||||
|
|
||||||
|
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="416" height="448"
|
||||||
|
viewBox="0 0 416 448" id="__github">
|
||||||
|
<path fill="currentColor" d="M160 304q0 10-3.125 20.5t-10.75 19-18.125
|
||||||
|
8.5-18.125-8.5-10.75-19-3.125-20.5 3.125-20.5 10.75-19 18.125-8.5
|
||||||
|
18.125 8.5 10.75 19 3.125 20.5zM320 304q0 10-3.125 20.5t-10.75
|
||||||
|
19-18.125 8.5-18.125-8.5-10.75-19-3.125-20.5 3.125-20.5 10.75-19
|
||||||
|
18.125-8.5 18.125 8.5 10.75 19 3.125 20.5zM360
|
||||||
|
304q0-30-17.25-51t-46.75-21q-10.25 0-48.75 5.25-17.75 2.75-39.25
|
||||||
|
2.75t-39.25-2.75q-38-5.25-48.75-5.25-29.5 0-46.75 21t-17.25 51q0 22 8
|
||||||
|
38.375t20.25 25.75 30.5 15 35 7.375 37.25 1.75h42q20.5 0
|
||||||
|
37.25-1.75t35-7.375 30.5-15 20.25-25.75 8-38.375zM416 260q0 51.75-15.25
|
||||||
|
82.75-9.5 19.25-26.375 33.25t-35.25 21.5-42.5 11.875-42.875 5.5-41.75
|
||||||
|
1.125q-19.5 0-35.5-0.75t-36.875-3.125-38.125-7.5-34.25-12.875-30.25-20.25-21.5-28.75q-15.5-30.75-15.5-82.75
|
||||||
|
0-59.25 34-99-6.75-20.5-6.75-42.5 0-29 12.75-54.5 27 0 47.5 9.875t47.25
|
||||||
|
30.875q36.75-8.75 77.25-8.75 37 0 70 8 26.25-20.5
|
||||||
|
46.75-30.25t47.25-9.75q12.75 25.5 12.75 54.5 0 21.75-6.75 42 34 40 34
|
||||||
|
99.5z" />
|
||||||
|
</svg>
|
||||||
|
|
||||||
|
</defs>
|
||||||
|
</svg>
|
||||||
|
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
|
||||||
|
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
|
||||||
|
<label class="md-overlay" data-md-component="overlay" for="__drawer"></label>
|
||||||
|
|
||||||
|
<a href="#yaml-to-json" tabindex="1" class="md-skip">
|
||||||
|
Skip to content
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
<header class="md-header" data-md-component="header">
|
||||||
|
<nav class="md-header-nav md-grid">
|
||||||
|
<div class="md-flex">
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<a href=".." title="Yq" class="md-header-nav__button md-logo">
|
||||||
|
|
||||||
|
<i class="md-icon"></i>
|
||||||
|
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<label class="md-icon md-icon--menu md-header-nav__button" for="__drawer"></label>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--stretch">
|
||||||
|
<div class="md-flex__ellipsis md-header-nav__title" data-md-component="title">
|
||||||
|
|
||||||
|
<span class="md-header-nav__topic">
|
||||||
|
Yq
|
||||||
|
</span>
|
||||||
|
<span class="md-header-nav__topic">
|
||||||
|
Convert
|
||||||
|
</span>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
|
||||||
|
<label class="md-icon md-icon--search md-header-nav__button" for="__search"></label>
|
||||||
|
|
||||||
|
<div class="md-search" data-md-component="search" role="dialog">
|
||||||
|
<label class="md-search__overlay" for="__search"></label>
|
||||||
|
<div class="md-search__inner" role="search">
|
||||||
|
<form class="md-search__form" name="search">
|
||||||
|
<input type="text" class="md-search__input" name="query" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="query" data-md-state="active">
|
||||||
|
<label class="md-icon md-search__icon" for="__search"></label>
|
||||||
|
<button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1">
|
||||||
|

|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
<div class="md-search__output">
|
||||||
|
<div class="md-search__scrollwrap" data-md-scrollfix>
|
||||||
|
<div class="md-search-result" data-md-component="result">
|
||||||
|
<div class="md-search-result__meta">
|
||||||
|
Type to start searching
|
||||||
|
</div>
|
||||||
|
<ol class="md-search-result__list"></ol>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<div class="md-header-nav__source">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a href="https://github.com/mikefarah/yq/" title="Go to repository" class="md-source" data-md-source="github">
|
||||||
|
|
||||||
|
<div class="md-source__icon">
|
||||||
|
<svg viewBox="0 0 24 24" width="24" height="24">
|
||||||
|
<use xlink:href="#__github" width="24" height="24"></use>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-source__repository">
|
||||||
|
mikefarah/yq
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="md-container">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<main class="md-main">
|
||||||
|
<div class="md-main__inner md-grid" data-md-component="container">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
|
||||||
|
<div class="md-sidebar__scrollwrap">
|
||||||
|
<div class="md-sidebar__inner">
|
||||||
|
<nav class="md-nav md-nav--primary" data-md-level="0">
|
||||||
|
<label class="md-nav__title md-nav__title--site" for="__drawer">
|
||||||
|
<a href=".." title="Yq" class="md-nav__button md-logo">
|
||||||
|
|
||||||
|
<i class="md-icon"></i>
|
||||||
|
|
||||||
|
</a>
|
||||||
|
Yq
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<div class="md-nav__source">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a href="https://github.com/mikefarah/yq/" title="Go to repository" class="md-source" data-md-source="github">
|
||||||
|
|
||||||
|
<div class="md-source__icon">
|
||||||
|
<svg viewBox="0 0 24 24" width="24" height="24">
|
||||||
|
<use xlink:href="#__github" width="24" height="24"></use>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-source__repository">
|
||||||
|
mikefarah/yq
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ul class="md-nav__list" data-md-scrollfix>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href=".." title="Install" class="md-nav__link">
|
||||||
|
Install
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../read/" title="Read" class="md-nav__link">
|
||||||
|
Read
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../write/" title="Write/Update" class="md-nav__link">
|
||||||
|
Write/Update
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../prefix/" title="Prefix" class="md-nav__link">
|
||||||
|
Prefix
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../delete/" title="Delete" class="md-nav__link">
|
||||||
|
Delete
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../create/" title="Create" class="md-nav__link">
|
||||||
|
Create
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item md-nav__item--active">
|
||||||
|
|
||||||
|
<input class="md-toggle md-nav__toggle" data-md-toggle="toc" type="checkbox" id="__toc">
|
||||||
|
|
||||||
|
|
||||||
|
<label class="md-nav__link md-nav__link--active" for="__toc">
|
||||||
|
Convert
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<a href="./" title="Convert" class="md-nav__link md-nav__link--active">
|
||||||
|
Convert
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
<nav class="md-nav md-nav--secondary">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<label class="md-nav__title" for="__toc">Table of contents</label>
|
||||||
|
<ul class="md-nav__list" data-md-scrollfix>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#yaml-to-json" title="Yaml to Json" class="md-nav__link">
|
||||||
|
Yaml to Json
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#json-to-yaml" title="Json to Yaml" class="md-nav__link">
|
||||||
|
Json to Yaml
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../merge/" title="Merge" class="md-nav__link">
|
||||||
|
Merge
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
|
||||||
|
<div class="md-sidebar__scrollwrap">
|
||||||
|
<div class="md-sidebar__inner">
|
||||||
|
|
||||||
|
<nav class="md-nav md-nav--secondary">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<label class="md-nav__title" for="__toc">Table of contents</label>
|
||||||
|
<ul class="md-nav__list" data-md-scrollfix>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#yaml-to-json" title="Yaml to Json" class="md-nav__link">
|
||||||
|
Yaml to Json
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#json-to-yaml" title="Json to Yaml" class="md-nav__link">
|
||||||
|
Json to Yaml
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="md-content">
|
||||||
|
<article class="md-content__inner md-typeset">
|
||||||
|
|
||||||
|
|
||||||
|
<a href="https://github.com/mikefarah/yq/edit/master/docs/convert.md" title="Edit this page" class="md-icon md-content__icon"></a>
|
||||||
|
|
||||||
|
|
||||||
|
<h1>Convert</h1>
|
||||||
|
|
||||||
|
<h3 id="yaml-to-json">Yaml to Json<a class="headerlink" href="#yaml-to-json" title="Permanent link">¶</a></h3>
|
||||||
|
<p>To convert output to json, use the --tojson (or -j) flag. This can only be used with the read command.</p>
|
||||||
|
<p>Given a sample.yaml file of:</p>
|
||||||
|
<pre><code class="yaml">b:
|
||||||
|
c: 2
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>then</p>
|
||||||
|
<pre><code class="bash">yq r -j sample.yaml b.c
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>will output</p>
|
||||||
|
<pre><code class="json">{"b":{"c":2}}
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<h3 id="json-to-yaml">Json to Yaml<a class="headerlink" href="#json-to-yaml" title="Permanent link">¶</a></h3>
|
||||||
|
<p>To read in json, just pass in a json file instead of yaml, it will just work :)</p>
|
||||||
|
<p>e.g given a json file</p>
|
||||||
|
<pre><code class="json">{"a":"Easy! as one two three","b":{"c":2,"d":[3,4]}}
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>then</p>
|
||||||
|
<pre><code class="bash">yq r sample.json
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>will output</p>
|
||||||
|
<pre><code class="yaml">a: Easy! as one two three
|
||||||
|
b:
|
||||||
|
c: 2
|
||||||
|
d:
|
||||||
|
- 3
|
||||||
|
- 4
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
|
||||||
|
<footer class="md-footer">
|
||||||
|
|
||||||
|
<div class="md-footer-nav">
|
||||||
|
<nav class="md-footer-nav__inner md-grid">
|
||||||
|
|
||||||
|
<a href="../create/" title="Create" class="md-flex md-footer-nav__link md-footer-nav__link--prev" rel="prev">
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<i class="md-icon md-icon--arrow-back md-footer-nav__button"></i>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
|
||||||
|
<span class="md-flex__ellipsis">
|
||||||
|
<span class="md-footer-nav__direction">
|
||||||
|
Previous
|
||||||
|
</span>
|
||||||
|
Create
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
<a href="../merge/" title="Merge" class="md-flex md-footer-nav__link md-footer-nav__link--next" rel="next">
|
||||||
|
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
|
||||||
|
<span class="md-flex__ellipsis">
|
||||||
|
<span class="md-footer-nav__direction">
|
||||||
|
Next
|
||||||
|
</span>
|
||||||
|
Merge
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<i class="md-icon md-icon--arrow-forward md-footer-nav__button"></i>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-footer-meta md-typeset">
|
||||||
|
<div class="md-footer-meta__inner md-grid">
|
||||||
|
<div class="md-footer-copyright">
|
||||||
|
|
||||||
|
powered by
|
||||||
|
<a href="https://www.mkdocs.org">MkDocs</a>
|
||||||
|
and
|
||||||
|
<a href="https://squidfunk.github.io/mkdocs-material/">
|
||||||
|
Material for MkDocs</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-footer-social">
|
||||||
|
<link rel="stylesheet" href="../assets/fonts/font-awesome.css">
|
||||||
|
|
||||||
|
<a href="https://github.com/mikefarah" class="md-footer-social__link fa fa-github"></a>
|
||||||
|
|
||||||
|
<a href="https://www.linkedin.com/in/mike-farah-b5a75b2/" class="md-footer-social__link fa fa-linkedin"></a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="../assets/javascripts/application.39abc4af.js"></script>
|
||||||
|
|
||||||
|
<script>app.initialize({version:"1.0.4",url:{base:".."}})</script>
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
586
docs/create/index.html
Normal file
586
docs/create/index.html
Normal file
@@ -0,0 +1,586 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="en" class="no-js">
|
||||||
|
<head>
|
||||||
|
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||||
|
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<meta name="lang:clipboard.copy" content="Copy to clipboard">
|
||||||
|
|
||||||
|
<meta name="lang:clipboard.copied" content="Copied to clipboard">
|
||||||
|
|
||||||
|
<meta name="lang:search.language" content="en">
|
||||||
|
|
||||||
|
<meta name="lang:search.pipeline.stopwords" content="True">
|
||||||
|
|
||||||
|
<meta name="lang:search.pipeline.trimmer" content="True">
|
||||||
|
|
||||||
|
<meta name="lang:search.result.none" content="No matching documents">
|
||||||
|
|
||||||
|
<meta name="lang:search.result.one" content="1 matching document">
|
||||||
|
|
||||||
|
<meta name="lang:search.result.other" content="# matching documents">
|
||||||
|
|
||||||
|
<meta name="lang:search.tokenizer" content="[\s\-]+">
|
||||||
|
|
||||||
|
<link rel="shortcut icon" href="../assets/images/favicon.png">
|
||||||
|
<meta name="generator" content="mkdocs-1.0.4, mkdocs-material-4.2.0">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<title>Create - Yq</title>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="../assets/stylesheets/application.750b69bd.css">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script src="../assets/javascripts/modernizr.74668098.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<link href="https://fonts.gstatic.com" rel="preconnect" crossorigin>
|
||||||
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700|Roboto+Mono">
|
||||||
|
<style>body,input{font-family:"Roboto","Helvetica Neue",Helvetica,Arial,sans-serif}code,kbd,pre{font-family:"Roboto Mono","Courier New",Courier,monospace}</style>
|
||||||
|
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="../assets/fonts/material-icons.css">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body dir="ltr">
|
||||||
|
|
||||||
|
<svg class="md-svg">
|
||||||
|
<defs>
|
||||||
|
|
||||||
|
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="416" height="448"
|
||||||
|
viewBox="0 0 416 448" id="__github">
|
||||||
|
<path fill="currentColor" d="M160 304q0 10-3.125 20.5t-10.75 19-18.125
|
||||||
|
8.5-18.125-8.5-10.75-19-3.125-20.5 3.125-20.5 10.75-19 18.125-8.5
|
||||||
|
18.125 8.5 10.75 19 3.125 20.5zM320 304q0 10-3.125 20.5t-10.75
|
||||||
|
19-18.125 8.5-18.125-8.5-10.75-19-3.125-20.5 3.125-20.5 10.75-19
|
||||||
|
18.125-8.5 18.125 8.5 10.75 19 3.125 20.5zM360
|
||||||
|
304q0-30-17.25-51t-46.75-21q-10.25 0-48.75 5.25-17.75 2.75-39.25
|
||||||
|
2.75t-39.25-2.75q-38-5.25-48.75-5.25-29.5 0-46.75 21t-17.25 51q0 22 8
|
||||||
|
38.375t20.25 25.75 30.5 15 35 7.375 37.25 1.75h42q20.5 0
|
||||||
|
37.25-1.75t35-7.375 30.5-15 20.25-25.75 8-38.375zM416 260q0 51.75-15.25
|
||||||
|
82.75-9.5 19.25-26.375 33.25t-35.25 21.5-42.5 11.875-42.875 5.5-41.75
|
||||||
|
1.125q-19.5 0-35.5-0.75t-36.875-3.125-38.125-7.5-34.25-12.875-30.25-20.25-21.5-28.75q-15.5-30.75-15.5-82.75
|
||||||
|
0-59.25 34-99-6.75-20.5-6.75-42.5 0-29 12.75-54.5 27 0 47.5 9.875t47.25
|
||||||
|
30.875q36.75-8.75 77.25-8.75 37 0 70 8 26.25-20.5
|
||||||
|
46.75-30.25t47.25-9.75q12.75 25.5 12.75 54.5 0 21.75-6.75 42 34 40 34
|
||||||
|
99.5z" />
|
||||||
|
</svg>
|
||||||
|
|
||||||
|
</defs>
|
||||||
|
</svg>
|
||||||
|
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
|
||||||
|
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
|
||||||
|
<label class="md-overlay" data-md-component="overlay" for="__drawer"></label>
|
||||||
|
|
||||||
|
<a href="#creating-a-simple-yaml-file" tabindex="1" class="md-skip">
|
||||||
|
Skip to content
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
<header class="md-header" data-md-component="header">
|
||||||
|
<nav class="md-header-nav md-grid">
|
||||||
|
<div class="md-flex">
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<a href=".." title="Yq" class="md-header-nav__button md-logo">
|
||||||
|
|
||||||
|
<i class="md-icon"></i>
|
||||||
|
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<label class="md-icon md-icon--menu md-header-nav__button" for="__drawer"></label>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--stretch">
|
||||||
|
<div class="md-flex__ellipsis md-header-nav__title" data-md-component="title">
|
||||||
|
|
||||||
|
<span class="md-header-nav__topic">
|
||||||
|
Yq
|
||||||
|
</span>
|
||||||
|
<span class="md-header-nav__topic">
|
||||||
|
Create
|
||||||
|
</span>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
|
||||||
|
<label class="md-icon md-icon--search md-header-nav__button" for="__search"></label>
|
||||||
|
|
||||||
|
<div class="md-search" data-md-component="search" role="dialog">
|
||||||
|
<label class="md-search__overlay" for="__search"></label>
|
||||||
|
<div class="md-search__inner" role="search">
|
||||||
|
<form class="md-search__form" name="search">
|
||||||
|
<input type="text" class="md-search__input" name="query" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="query" data-md-state="active">
|
||||||
|
<label class="md-icon md-search__icon" for="__search"></label>
|
||||||
|
<button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1">
|
||||||
|

|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
<div class="md-search__output">
|
||||||
|
<div class="md-search__scrollwrap" data-md-scrollfix>
|
||||||
|
<div class="md-search-result" data-md-component="result">
|
||||||
|
<div class="md-search-result__meta">
|
||||||
|
Type to start searching
|
||||||
|
</div>
|
||||||
|
<ol class="md-search-result__list"></ol>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<div class="md-header-nav__source">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a href="https://github.com/mikefarah/yq/" title="Go to repository" class="md-source" data-md-source="github">
|
||||||
|
|
||||||
|
<div class="md-source__icon">
|
||||||
|
<svg viewBox="0 0 24 24" width="24" height="24">
|
||||||
|
<use xlink:href="#__github" width="24" height="24"></use>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-source__repository">
|
||||||
|
mikefarah/yq
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="md-container">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<main class="md-main">
|
||||||
|
<div class="md-main__inner md-grid" data-md-component="container">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
|
||||||
|
<div class="md-sidebar__scrollwrap">
|
||||||
|
<div class="md-sidebar__inner">
|
||||||
|
<nav class="md-nav md-nav--primary" data-md-level="0">
|
||||||
|
<label class="md-nav__title md-nav__title--site" for="__drawer">
|
||||||
|
<a href=".." title="Yq" class="md-nav__button md-logo">
|
||||||
|
|
||||||
|
<i class="md-icon"></i>
|
||||||
|
|
||||||
|
</a>
|
||||||
|
Yq
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<div class="md-nav__source">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a href="https://github.com/mikefarah/yq/" title="Go to repository" class="md-source" data-md-source="github">
|
||||||
|
|
||||||
|
<div class="md-source__icon">
|
||||||
|
<svg viewBox="0 0 24 24" width="24" height="24">
|
||||||
|
<use xlink:href="#__github" width="24" height="24"></use>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-source__repository">
|
||||||
|
mikefarah/yq
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ul class="md-nav__list" data-md-scrollfix>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href=".." title="Install" class="md-nav__link">
|
||||||
|
Install
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../read/" title="Read" class="md-nav__link">
|
||||||
|
Read
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../write/" title="Write/Update" class="md-nav__link">
|
||||||
|
Write/Update
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../prefix/" title="Prefix" class="md-nav__link">
|
||||||
|
Prefix
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../delete/" title="Delete" class="md-nav__link">
|
||||||
|
Delete
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item md-nav__item--active">
|
||||||
|
|
||||||
|
<input class="md-toggle md-nav__toggle" data-md-toggle="toc" type="checkbox" id="__toc">
|
||||||
|
|
||||||
|
|
||||||
|
<label class="md-nav__link md-nav__link--active" for="__toc">
|
||||||
|
Create
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<a href="./" title="Create" class="md-nav__link md-nav__link--active">
|
||||||
|
Create
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
<nav class="md-nav md-nav--secondary">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<label class="md-nav__title" for="__toc">Table of contents</label>
|
||||||
|
<ul class="md-nav__list" data-md-scrollfix>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#creating-a-simple-yaml-file" title="Creating a simple yaml file" class="md-nav__link">
|
||||||
|
Creating a simple yaml file
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#creating-using-a-create-script" title="Creating using a create script" class="md-nav__link">
|
||||||
|
Creating using a create script
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#keys-with-dots" title="Keys with dots" class="md-nav__link">
|
||||||
|
Keys with dots
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#keys-and-values-with-leading-dashes" title="Keys (and values) with leading dashes" class="md-nav__link">
|
||||||
|
Keys (and values) with leading dashes
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../convert/" title="Convert" class="md-nav__link">
|
||||||
|
Convert
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../merge/" title="Merge" class="md-nav__link">
|
||||||
|
Merge
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
|
||||||
|
<div class="md-sidebar__scrollwrap">
|
||||||
|
<div class="md-sidebar__inner">
|
||||||
|
|
||||||
|
<nav class="md-nav md-nav--secondary">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<label class="md-nav__title" for="__toc">Table of contents</label>
|
||||||
|
<ul class="md-nav__list" data-md-scrollfix>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#creating-a-simple-yaml-file" title="Creating a simple yaml file" class="md-nav__link">
|
||||||
|
Creating a simple yaml file
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#creating-using-a-create-script" title="Creating using a create script" class="md-nav__link">
|
||||||
|
Creating using a create script
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#keys-with-dots" title="Keys with dots" class="md-nav__link">
|
||||||
|
Keys with dots
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#keys-and-values-with-leading-dashes" title="Keys (and values) with leading dashes" class="md-nav__link">
|
||||||
|
Keys (and values) with leading dashes
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="md-content">
|
||||||
|
<article class="md-content__inner md-typeset">
|
||||||
|
|
||||||
|
|
||||||
|
<a href="https://github.com/mikefarah/yq/edit/master/docs/create.md" title="Edit this page" class="md-icon md-content__icon"></a>
|
||||||
|
|
||||||
|
|
||||||
|
<h1>Create</h1>
|
||||||
|
|
||||||
|
<p>Yaml files can be created using the 'new' command. This works in the same way as the write command, but you don't pass in an existing Yaml file. Currently this does not support creating multiple documents in a single yaml file.</p>
|
||||||
|
<pre><code>yq n <path> <new value>
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<h3 id="creating-a-simple-yaml-file">Creating a simple yaml file<a class="headerlink" href="#creating-a-simple-yaml-file" title="Permanent link">¶</a></h3>
|
||||||
|
<pre><code class="bash">yq n b.c cat
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>will output:</p>
|
||||||
|
<pre><code class="yaml">b:
|
||||||
|
c: cat
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<h3 id="creating-using-a-create-script">Creating using a create script<a class="headerlink" href="#creating-using-a-create-script" title="Permanent link">¶</a></h3>
|
||||||
|
<p>Create scripts follow the same format as the update scripts.</p>
|
||||||
|
<p>Given a script create_instructions.yaml of:</p>
|
||||||
|
<pre><code class="yaml">b.c: 3
|
||||||
|
b.e[+].name: Howdy Partner
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>then</p>
|
||||||
|
<pre><code class="bash">yq n -s create_instructions.yaml
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>will output:</p>
|
||||||
|
<pre><code class="yaml">b:
|
||||||
|
c: 3
|
||||||
|
e:
|
||||||
|
- name: Howdy Partner
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>You can also pipe the instructions in:</p>
|
||||||
|
<pre><code class="bash">cat create_instructions.yaml | yq n -s -
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<h3 id="keys-with-dots">Keys with dots<a class="headerlink" href="#keys-with-dots" title="Permanent link">¶</a></h3>
|
||||||
|
<p>When specifying a key that has a dot use key lookup indicator.</p>
|
||||||
|
<pre><code class="yaml">b:
|
||||||
|
foo.bar: 7
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<pre><code class="bash">yaml r sample.yaml 'b[foo.bar]'
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<pre><code class="bash">yaml w sample.yaml 'b[foo.bar]' 9
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>Any valid yaml key can be specified as part of a key lookup.</p>
|
||||||
|
<p>Note that the path is in quotes to avoid the square brackets being interpreted by your shell.</p>
|
||||||
|
<h3 id="keys-and-values-with-leading-dashes">Keys (and values) with leading dashes<a class="headerlink" href="#keys-and-values-with-leading-dashes" title="Permanent link">¶</a></h3>
|
||||||
|
<p>If a key or value has leading dashes, yq won't know that you are passing a value as opposed to a flag (and you will get a 'bad flag syntax' error).</p>
|
||||||
|
<p>To fix that, you will need to tell it to stop processing flags by adding '--' after the last flag like so:</p>
|
||||||
|
<pre><code class="bash">yq n -t -- --key --value
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>Will result in</p>
|
||||||
|
<p><code>`
|
||||||
|
--key: --value</code></p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
|
||||||
|
<footer class="md-footer">
|
||||||
|
|
||||||
|
<div class="md-footer-nav">
|
||||||
|
<nav class="md-footer-nav__inner md-grid">
|
||||||
|
|
||||||
|
<a href="../delete/" title="Delete" class="md-flex md-footer-nav__link md-footer-nav__link--prev" rel="prev">
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<i class="md-icon md-icon--arrow-back md-footer-nav__button"></i>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
|
||||||
|
<span class="md-flex__ellipsis">
|
||||||
|
<span class="md-footer-nav__direction">
|
||||||
|
Previous
|
||||||
|
</span>
|
||||||
|
Delete
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
<a href="../convert/" title="Convert" class="md-flex md-footer-nav__link md-footer-nav__link--next" rel="next">
|
||||||
|
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
|
||||||
|
<span class="md-flex__ellipsis">
|
||||||
|
<span class="md-footer-nav__direction">
|
||||||
|
Next
|
||||||
|
</span>
|
||||||
|
Convert
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<i class="md-icon md-icon--arrow-forward md-footer-nav__button"></i>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-footer-meta md-typeset">
|
||||||
|
<div class="md-footer-meta__inner md-grid">
|
||||||
|
<div class="md-footer-copyright">
|
||||||
|
|
||||||
|
powered by
|
||||||
|
<a href="https://www.mkdocs.org">MkDocs</a>
|
||||||
|
and
|
||||||
|
<a href="https://squidfunk.github.io/mkdocs-material/">
|
||||||
|
Material for MkDocs</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-footer-social">
|
||||||
|
<link rel="stylesheet" href="../assets/fonts/font-awesome.css">
|
||||||
|
|
||||||
|
<a href="https://github.com/mikefarah" class="md-footer-social__link fa fa-github"></a>
|
||||||
|
|
||||||
|
<a href="https://www.linkedin.com/in/mike-farah-b5a75b2/" class="md-footer-social__link fa fa-linkedin"></a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="../assets/javascripts/application.39abc4af.js"></script>
|
||||||
|
|
||||||
|
<script>app.initialize({version:"1.0.4",url:{base:".."}})</script>
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
833
docs/delete/index.html
Normal file
833
docs/delete/index.html
Normal file
@@ -0,0 +1,833 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="en" class="no-js">
|
||||||
|
<head>
|
||||||
|
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||||
|
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<meta name="lang:clipboard.copy" content="Copy to clipboard">
|
||||||
|
|
||||||
|
<meta name="lang:clipboard.copied" content="Copied to clipboard">
|
||||||
|
|
||||||
|
<meta name="lang:search.language" content="en">
|
||||||
|
|
||||||
|
<meta name="lang:search.pipeline.stopwords" content="True">
|
||||||
|
|
||||||
|
<meta name="lang:search.pipeline.trimmer" content="True">
|
||||||
|
|
||||||
|
<meta name="lang:search.result.none" content="No matching documents">
|
||||||
|
|
||||||
|
<meta name="lang:search.result.one" content="1 matching document">
|
||||||
|
|
||||||
|
<meta name="lang:search.result.other" content="# matching documents">
|
||||||
|
|
||||||
|
<meta name="lang:search.tokenizer" content="[\s\-]+">
|
||||||
|
|
||||||
|
<link rel="shortcut icon" href="../assets/images/favicon.png">
|
||||||
|
<meta name="generator" content="mkdocs-1.0.4, mkdocs-material-4.2.0">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<title>Delete - Yq</title>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="../assets/stylesheets/application.750b69bd.css">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script src="../assets/javascripts/modernizr.74668098.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<link href="https://fonts.gstatic.com" rel="preconnect" crossorigin>
|
||||||
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700|Roboto+Mono">
|
||||||
|
<style>body,input{font-family:"Roboto","Helvetica Neue",Helvetica,Arial,sans-serif}code,kbd,pre{font-family:"Roboto Mono","Courier New",Courier,monospace}</style>
|
||||||
|
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="../assets/fonts/material-icons.css">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body dir="ltr">
|
||||||
|
|
||||||
|
<svg class="md-svg">
|
||||||
|
<defs>
|
||||||
|
|
||||||
|
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="416" height="448"
|
||||||
|
viewBox="0 0 416 448" id="__github">
|
||||||
|
<path fill="currentColor" d="M160 304q0 10-3.125 20.5t-10.75 19-18.125
|
||||||
|
8.5-18.125-8.5-10.75-19-3.125-20.5 3.125-20.5 10.75-19 18.125-8.5
|
||||||
|
18.125 8.5 10.75 19 3.125 20.5zM320 304q0 10-3.125 20.5t-10.75
|
||||||
|
19-18.125 8.5-18.125-8.5-10.75-19-3.125-20.5 3.125-20.5 10.75-19
|
||||||
|
18.125-8.5 18.125 8.5 10.75 19 3.125 20.5zM360
|
||||||
|
304q0-30-17.25-51t-46.75-21q-10.25 0-48.75 5.25-17.75 2.75-39.25
|
||||||
|
2.75t-39.25-2.75q-38-5.25-48.75-5.25-29.5 0-46.75 21t-17.25 51q0 22 8
|
||||||
|
38.375t20.25 25.75 30.5 15 35 7.375 37.25 1.75h42q20.5 0
|
||||||
|
37.25-1.75t35-7.375 30.5-15 20.25-25.75 8-38.375zM416 260q0 51.75-15.25
|
||||||
|
82.75-9.5 19.25-26.375 33.25t-35.25 21.5-42.5 11.875-42.875 5.5-41.75
|
||||||
|
1.125q-19.5 0-35.5-0.75t-36.875-3.125-38.125-7.5-34.25-12.875-30.25-20.25-21.5-28.75q-15.5-30.75-15.5-82.75
|
||||||
|
0-59.25 34-99-6.75-20.5-6.75-42.5 0-29 12.75-54.5 27 0 47.5 9.875t47.25
|
||||||
|
30.875q36.75-8.75 77.25-8.75 37 0 70 8 26.25-20.5
|
||||||
|
46.75-30.25t47.25-9.75q12.75 25.5 12.75 54.5 0 21.75-6.75 42 34 40 34
|
||||||
|
99.5z" />
|
||||||
|
</svg>
|
||||||
|
|
||||||
|
</defs>
|
||||||
|
</svg>
|
||||||
|
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
|
||||||
|
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
|
||||||
|
<label class="md-overlay" data-md-component="overlay" for="__drawer"></label>
|
||||||
|
|
||||||
|
<a href="#to-stdout" tabindex="1" class="md-skip">
|
||||||
|
Skip to content
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
<header class="md-header" data-md-component="header">
|
||||||
|
<nav class="md-header-nav md-grid">
|
||||||
|
<div class="md-flex">
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<a href=".." title="Yq" class="md-header-nav__button md-logo">
|
||||||
|
|
||||||
|
<i class="md-icon"></i>
|
||||||
|
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<label class="md-icon md-icon--menu md-header-nav__button" for="__drawer"></label>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--stretch">
|
||||||
|
<div class="md-flex__ellipsis md-header-nav__title" data-md-component="title">
|
||||||
|
|
||||||
|
<span class="md-header-nav__topic">
|
||||||
|
Yq
|
||||||
|
</span>
|
||||||
|
<span class="md-header-nav__topic">
|
||||||
|
Delete
|
||||||
|
</span>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
|
||||||
|
<label class="md-icon md-icon--search md-header-nav__button" for="__search"></label>
|
||||||
|
|
||||||
|
<div class="md-search" data-md-component="search" role="dialog">
|
||||||
|
<label class="md-search__overlay" for="__search"></label>
|
||||||
|
<div class="md-search__inner" role="search">
|
||||||
|
<form class="md-search__form" name="search">
|
||||||
|
<input type="text" class="md-search__input" name="query" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="query" data-md-state="active">
|
||||||
|
<label class="md-icon md-search__icon" for="__search"></label>
|
||||||
|
<button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1">
|
||||||
|

|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
<div class="md-search__output">
|
||||||
|
<div class="md-search__scrollwrap" data-md-scrollfix>
|
||||||
|
<div class="md-search-result" data-md-component="result">
|
||||||
|
<div class="md-search-result__meta">
|
||||||
|
Type to start searching
|
||||||
|
</div>
|
||||||
|
<ol class="md-search-result__list"></ol>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<div class="md-header-nav__source">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a href="https://github.com/mikefarah/yq/" title="Go to repository" class="md-source" data-md-source="github">
|
||||||
|
|
||||||
|
<div class="md-source__icon">
|
||||||
|
<svg viewBox="0 0 24 24" width="24" height="24">
|
||||||
|
<use xlink:href="#__github" width="24" height="24"></use>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-source__repository">
|
||||||
|
mikefarah/yq
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="md-container">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<main class="md-main">
|
||||||
|
<div class="md-main__inner md-grid" data-md-component="container">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
|
||||||
|
<div class="md-sidebar__scrollwrap">
|
||||||
|
<div class="md-sidebar__inner">
|
||||||
|
<nav class="md-nav md-nav--primary" data-md-level="0">
|
||||||
|
<label class="md-nav__title md-nav__title--site" for="__drawer">
|
||||||
|
<a href=".." title="Yq" class="md-nav__button md-logo">
|
||||||
|
|
||||||
|
<i class="md-icon"></i>
|
||||||
|
|
||||||
|
</a>
|
||||||
|
Yq
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<div class="md-nav__source">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a href="https://github.com/mikefarah/yq/" title="Go to repository" class="md-source" data-md-source="github">
|
||||||
|
|
||||||
|
<div class="md-source__icon">
|
||||||
|
<svg viewBox="0 0 24 24" width="24" height="24">
|
||||||
|
<use xlink:href="#__github" width="24" height="24"></use>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-source__repository">
|
||||||
|
mikefarah/yq
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ul class="md-nav__list" data-md-scrollfix>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href=".." title="Install" class="md-nav__link">
|
||||||
|
Install
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../read/" title="Read" class="md-nav__link">
|
||||||
|
Read
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../write/" title="Write/Update" class="md-nav__link">
|
||||||
|
Write/Update
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../prefix/" title="Prefix" class="md-nav__link">
|
||||||
|
Prefix
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item md-nav__item--active">
|
||||||
|
|
||||||
|
<input class="md-toggle md-nav__toggle" data-md-toggle="toc" type="checkbox" id="__toc">
|
||||||
|
|
||||||
|
|
||||||
|
<label class="md-nav__link md-nav__link--active" for="__toc">
|
||||||
|
Delete
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<a href="./" title="Delete" class="md-nav__link md-nav__link--active">
|
||||||
|
Delete
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
<nav class="md-nav md-nav--secondary">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<label class="md-nav__title" for="__toc">Table of contents</label>
|
||||||
|
<ul class="md-nav__list" data-md-scrollfix>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#to-stdout" title="To Stdout" class="md-nav__link">
|
||||||
|
To Stdout
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#from-stdin" title="From STDIN" class="md-nav__link">
|
||||||
|
From STDIN
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#deleting-array-elements" title="Deleting array elements" class="md-nav__link">
|
||||||
|
Deleting array elements
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#deleting-nodes-in-place" title="Deleting nodes in-place" class="md-nav__link">
|
||||||
|
Deleting nodes in-place
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#splat" title="Splat" class="md-nav__link">
|
||||||
|
Splat
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#prefix-splat" title="Prefix Splat" class="md-nav__link">
|
||||||
|
Prefix Splat
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#array-splat" title="Array Splat" class="md-nav__link">
|
||||||
|
Array Splat
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#multiple-documents-delete-from-single-document" title="Multiple Documents - delete from single document" class="md-nav__link">
|
||||||
|
Multiple Documents - delete from single document
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#multiple-documents-delete-from-all-documents" title="Multiple Documents - delete from all documents" class="md-nav__link">
|
||||||
|
Multiple Documents - delete from all documents
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#keys-with-dots" title="Keys with dots" class="md-nav__link">
|
||||||
|
Keys with dots
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#keys-and-values-with-leading-dashes" title="Keys (and values) with leading dashes" class="md-nav__link">
|
||||||
|
Keys (and values) with leading dashes
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../create/" title="Create" class="md-nav__link">
|
||||||
|
Create
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../convert/" title="Convert" class="md-nav__link">
|
||||||
|
Convert
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../merge/" title="Merge" class="md-nav__link">
|
||||||
|
Merge
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
|
||||||
|
<div class="md-sidebar__scrollwrap">
|
||||||
|
<div class="md-sidebar__inner">
|
||||||
|
|
||||||
|
<nav class="md-nav md-nav--secondary">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<label class="md-nav__title" for="__toc">Table of contents</label>
|
||||||
|
<ul class="md-nav__list" data-md-scrollfix>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#to-stdout" title="To Stdout" class="md-nav__link">
|
||||||
|
To Stdout
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#from-stdin" title="From STDIN" class="md-nav__link">
|
||||||
|
From STDIN
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#deleting-array-elements" title="Deleting array elements" class="md-nav__link">
|
||||||
|
Deleting array elements
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#deleting-nodes-in-place" title="Deleting nodes in-place" class="md-nav__link">
|
||||||
|
Deleting nodes in-place
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#splat" title="Splat" class="md-nav__link">
|
||||||
|
Splat
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#prefix-splat" title="Prefix Splat" class="md-nav__link">
|
||||||
|
Prefix Splat
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#array-splat" title="Array Splat" class="md-nav__link">
|
||||||
|
Array Splat
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#multiple-documents-delete-from-single-document" title="Multiple Documents - delete from single document" class="md-nav__link">
|
||||||
|
Multiple Documents - delete from single document
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#multiple-documents-delete-from-all-documents" title="Multiple Documents - delete from all documents" class="md-nav__link">
|
||||||
|
Multiple Documents - delete from all documents
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#keys-with-dots" title="Keys with dots" class="md-nav__link">
|
||||||
|
Keys with dots
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#keys-and-values-with-leading-dashes" title="Keys (and values) with leading dashes" class="md-nav__link">
|
||||||
|
Keys (and values) with leading dashes
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="md-content">
|
||||||
|
<article class="md-content__inner md-typeset">
|
||||||
|
|
||||||
|
|
||||||
|
<a href="https://github.com/mikefarah/yq/edit/master/docs/delete.md" title="Edit this page" class="md-icon md-content__icon"></a>
|
||||||
|
|
||||||
|
|
||||||
|
<h1>Delete</h1>
|
||||||
|
|
||||||
|
<pre><code>yq d <yaml_file> <path_to_delete>
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<h3 id="to-stdout">To Stdout<a class="headerlink" href="#to-stdout" title="Permanent link">¶</a></h3>
|
||||||
|
<p>Given a sample.yaml file of:</p>
|
||||||
|
<pre><code class="yaml">b:
|
||||||
|
c: 2
|
||||||
|
apples: green
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>then</p>
|
||||||
|
<pre><code class="bash">yq d sample.yaml b.c
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>will output:</p>
|
||||||
|
<pre><code class="yaml">b:
|
||||||
|
apples: green
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<h3 id="from-stdin">From STDIN<a class="headerlink" href="#from-stdin" title="Permanent link">¶</a></h3>
|
||||||
|
<pre><code class="bash">cat sample.yaml | yq d - b.c
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<h3 id="deleting-array-elements">Deleting array elements<a class="headerlink" href="#deleting-array-elements" title="Permanent link">¶</a></h3>
|
||||||
|
<p>Given a sample.yaml file of:</p>
|
||||||
|
<pre><code class="yaml">b:
|
||||||
|
c:
|
||||||
|
- 1
|
||||||
|
- 2
|
||||||
|
- 3
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>then</p>
|
||||||
|
<pre><code class="bash">yq d sample.yaml 'b.c[1]'
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>will output:</p>
|
||||||
|
<pre><code class="yaml">b:
|
||||||
|
c:
|
||||||
|
- 1
|
||||||
|
- 3
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<h3 id="deleting-nodes-in-place">Deleting nodes in-place<a class="headerlink" href="#deleting-nodes-in-place" title="Permanent link">¶</a></h3>
|
||||||
|
<p>Given a sample.yaml file of:</p>
|
||||||
|
<pre><code class="yaml">b:
|
||||||
|
c: 2
|
||||||
|
apples: green
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>then</p>
|
||||||
|
<pre><code class="bash">yq d -i sample.yaml b.c
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>will update the sample.yaml file so that the 'c' node is deleted</p>
|
||||||
|
<h3 id="splat">Splat<a class="headerlink" href="#splat" title="Permanent link">¶</a></h3>
|
||||||
|
<p>Given a sample.yaml file of:</p>
|
||||||
|
<pre><code class="yaml">---
|
||||||
|
bob:
|
||||||
|
item1:
|
||||||
|
cats: bananas
|
||||||
|
dogs: woof
|
||||||
|
item2:
|
||||||
|
cats: apples
|
||||||
|
dogs: woof2
|
||||||
|
thing:
|
||||||
|
cats: oranges
|
||||||
|
dogs: woof3
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>then</p>
|
||||||
|
<pre><code class="bash">yq d sample.yaml bob.*.cats
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>will output:</p>
|
||||||
|
<pre><code class="yaml">---
|
||||||
|
bob:
|
||||||
|
item1:
|
||||||
|
dogs: woof
|
||||||
|
item2:
|
||||||
|
dogs: woof2
|
||||||
|
thing:
|
||||||
|
dogs: woof3
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<h3 id="prefix-splat">Prefix Splat<a class="headerlink" href="#prefix-splat" title="Permanent link">¶</a></h3>
|
||||||
|
<p>Given a sample.yaml file of:</p>
|
||||||
|
<pre><code class="yaml">---
|
||||||
|
bob:
|
||||||
|
item1:
|
||||||
|
cats: bananas
|
||||||
|
dogs: woof
|
||||||
|
item2:
|
||||||
|
cats: apples
|
||||||
|
dogs: woof2
|
||||||
|
thing:
|
||||||
|
cats: oranges
|
||||||
|
dogs: woof3
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>then</p>
|
||||||
|
<pre><code class="bash">yq d sample.yaml bob.item*.cats
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>will output:</p>
|
||||||
|
<pre><code class="yaml">---
|
||||||
|
bob:
|
||||||
|
item1:
|
||||||
|
dogs: woof
|
||||||
|
item2:
|
||||||
|
dogs: woof2
|
||||||
|
thing:
|
||||||
|
cats: oranges
|
||||||
|
dogs: woof3
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<h3 id="array-splat">Array Splat<a class="headerlink" href="#array-splat" title="Permanent link">¶</a></h3>
|
||||||
|
<p>Given a sample.yaml file of:</p>
|
||||||
|
<pre><code class="yaml">---
|
||||||
|
bob:
|
||||||
|
- cats: bananas
|
||||||
|
dogs: woof
|
||||||
|
- cats: apples
|
||||||
|
dogs: woof2
|
||||||
|
- cats: oranges
|
||||||
|
dogs: woof3
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>then</p>
|
||||||
|
<pre><code class="bash">yq d sample.yaml bob.[*].cats
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>will output:</p>
|
||||||
|
<pre><code class="yaml">---
|
||||||
|
bob:
|
||||||
|
- dogs: woof
|
||||||
|
- dogs: woof2
|
||||||
|
- dogs: woof3
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<h3 id="multiple-documents-delete-from-single-document">Multiple Documents - delete from single document<a class="headerlink" href="#multiple-documents-delete-from-single-document" title="Permanent link">¶</a></h3>
|
||||||
|
<p>Given a sample.yaml file of:</p>
|
||||||
|
<pre><code class="yaml">something: else
|
||||||
|
field: leaveMe
|
||||||
|
---
|
||||||
|
b:
|
||||||
|
c: 2
|
||||||
|
field: deleteMe
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>then</p>
|
||||||
|
<pre><code class="bash">yq w -d1 sample.yaml field
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>will output:</p>
|
||||||
|
<pre><code class="yaml">something: else
|
||||||
|
field: leaveMe
|
||||||
|
---
|
||||||
|
b:
|
||||||
|
c: 2
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<h3 id="multiple-documents-delete-from-all-documents">Multiple Documents - delete from all documents<a class="headerlink" href="#multiple-documents-delete-from-all-documents" title="Permanent link">¶</a></h3>
|
||||||
|
<p>Given a sample.yaml file of:</p>
|
||||||
|
<pre><code class="yaml">something: else
|
||||||
|
field: deleteMe
|
||||||
|
---
|
||||||
|
b:
|
||||||
|
c: 2
|
||||||
|
field: deleteMeToo
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>then</p>
|
||||||
|
<pre><code class="bash">yq w -d'*' sample.yaml field
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>will output:</p>
|
||||||
|
<pre><code class="yaml">something: else
|
||||||
|
---
|
||||||
|
b:
|
||||||
|
c: 2
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>Note that '*' is in quotes to avoid being interpreted by your shell.</p>
|
||||||
|
<h3 id="keys-with-dots">Keys with dots<a class="headerlink" href="#keys-with-dots" title="Permanent link">¶</a></h3>
|
||||||
|
<p>When specifying a key that has a dot use key lookup indicator.</p>
|
||||||
|
<pre><code class="yaml">b:
|
||||||
|
foo.bar: 7
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<pre><code class="bash">yaml r sample.yaml 'b[foo.bar]'
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<pre><code class="bash">yaml w sample.yaml 'b[foo.bar]' 9
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>Any valid yaml key can be specified as part of a key lookup.</p>
|
||||||
|
<p>Note that the path is in quotes to avoid the square brackets being interpreted by your shell.</p>
|
||||||
|
<h3 id="keys-and-values-with-leading-dashes">Keys (and values) with leading dashes<a class="headerlink" href="#keys-and-values-with-leading-dashes" title="Permanent link">¶</a></h3>
|
||||||
|
<p>If a key or value has leading dashes, yq won't know that you are passing a value as opposed to a flag (and you will get a 'bad flag syntax' error).</p>
|
||||||
|
<p>To fix that, you will need to tell it to stop processing flags by adding '--' after the last flag like so:</p>
|
||||||
|
<pre><code class="bash">yq n -t -- --key --value
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>Will result in</p>
|
||||||
|
<p><code>`
|
||||||
|
--key: --value</code></p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
|
||||||
|
<footer class="md-footer">
|
||||||
|
|
||||||
|
<div class="md-footer-nav">
|
||||||
|
<nav class="md-footer-nav__inner md-grid">
|
||||||
|
|
||||||
|
<a href="../prefix/" title="Prefix" class="md-flex md-footer-nav__link md-footer-nav__link--prev" rel="prev">
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<i class="md-icon md-icon--arrow-back md-footer-nav__button"></i>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
|
||||||
|
<span class="md-flex__ellipsis">
|
||||||
|
<span class="md-footer-nav__direction">
|
||||||
|
Previous
|
||||||
|
</span>
|
||||||
|
Prefix
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
<a href="../create/" title="Create" class="md-flex md-footer-nav__link md-footer-nav__link--next" rel="next">
|
||||||
|
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
|
||||||
|
<span class="md-flex__ellipsis">
|
||||||
|
<span class="md-footer-nav__direction">
|
||||||
|
Next
|
||||||
|
</span>
|
||||||
|
Create
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<i class="md-icon md-icon--arrow-forward md-footer-nav__button"></i>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-footer-meta md-typeset">
|
||||||
|
<div class="md-footer-meta__inner md-grid">
|
||||||
|
<div class="md-footer-copyright">
|
||||||
|
|
||||||
|
powered by
|
||||||
|
<a href="https://www.mkdocs.org">MkDocs</a>
|
||||||
|
and
|
||||||
|
<a href="https://squidfunk.github.io/mkdocs-material/">
|
||||||
|
Material for MkDocs</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-footer-social">
|
||||||
|
<link rel="stylesheet" href="../assets/fonts/font-awesome.css">
|
||||||
|
|
||||||
|
<a href="https://github.com/mikefarah" class="md-footer-social__link fa fa-github"></a>
|
||||||
|
|
||||||
|
<a href="https://www.linkedin.com/in/mike-farah-b5a75b2/" class="md-footer-social__link fa fa-linkedin"></a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="../assets/javascripts/application.39abc4af.js"></script>
|
||||||
|
|
||||||
|
<script>app.initialize({version:"1.0.4",url:{base:".."}})</script>
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
499
docs/index.html
Normal file
499
docs/index.html
Normal file
@@ -0,0 +1,499 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="en" class="no-js">
|
||||||
|
<head>
|
||||||
|
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||||
|
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<meta name="lang:clipboard.copy" content="Copy to clipboard">
|
||||||
|
|
||||||
|
<meta name="lang:clipboard.copied" content="Copied to clipboard">
|
||||||
|
|
||||||
|
<meta name="lang:search.language" content="en">
|
||||||
|
|
||||||
|
<meta name="lang:search.pipeline.stopwords" content="True">
|
||||||
|
|
||||||
|
<meta name="lang:search.pipeline.trimmer" content="True">
|
||||||
|
|
||||||
|
<meta name="lang:search.result.none" content="No matching documents">
|
||||||
|
|
||||||
|
<meta name="lang:search.result.one" content="1 matching document">
|
||||||
|
|
||||||
|
<meta name="lang:search.result.other" content="# matching documents">
|
||||||
|
|
||||||
|
<meta name="lang:search.tokenizer" content="[\s\-]+">
|
||||||
|
|
||||||
|
<link rel="shortcut icon" href="assets/images/favicon.png">
|
||||||
|
<meta name="generator" content="mkdocs-1.0.4, mkdocs-material-4.2.0">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<title>Yq</title>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="assets/stylesheets/application.750b69bd.css">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script src="assets/javascripts/modernizr.74668098.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<link href="https://fonts.gstatic.com" rel="preconnect" crossorigin>
|
||||||
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700|Roboto+Mono">
|
||||||
|
<style>body,input{font-family:"Roboto","Helvetica Neue",Helvetica,Arial,sans-serif}code,kbd,pre{font-family:"Roboto Mono","Courier New",Courier,monospace}</style>
|
||||||
|
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="assets/fonts/material-icons.css">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body dir="ltr">
|
||||||
|
|
||||||
|
<svg class="md-svg">
|
||||||
|
<defs>
|
||||||
|
|
||||||
|
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="416" height="448"
|
||||||
|
viewBox="0 0 416 448" id="__github">
|
||||||
|
<path fill="currentColor" d="M160 304q0 10-3.125 20.5t-10.75 19-18.125
|
||||||
|
8.5-18.125-8.5-10.75-19-3.125-20.5 3.125-20.5 10.75-19 18.125-8.5
|
||||||
|
18.125 8.5 10.75 19 3.125 20.5zM320 304q0 10-3.125 20.5t-10.75
|
||||||
|
19-18.125 8.5-18.125-8.5-10.75-19-3.125-20.5 3.125-20.5 10.75-19
|
||||||
|
18.125-8.5 18.125 8.5 10.75 19 3.125 20.5zM360
|
||||||
|
304q0-30-17.25-51t-46.75-21q-10.25 0-48.75 5.25-17.75 2.75-39.25
|
||||||
|
2.75t-39.25-2.75q-38-5.25-48.75-5.25-29.5 0-46.75 21t-17.25 51q0 22 8
|
||||||
|
38.375t20.25 25.75 30.5 15 35 7.375 37.25 1.75h42q20.5 0
|
||||||
|
37.25-1.75t35-7.375 30.5-15 20.25-25.75 8-38.375zM416 260q0 51.75-15.25
|
||||||
|
82.75-9.5 19.25-26.375 33.25t-35.25 21.5-42.5 11.875-42.875 5.5-41.75
|
||||||
|
1.125q-19.5 0-35.5-0.75t-36.875-3.125-38.125-7.5-34.25-12.875-30.25-20.25-21.5-28.75q-15.5-30.75-15.5-82.75
|
||||||
|
0-59.25 34-99-6.75-20.5-6.75-42.5 0-29 12.75-54.5 27 0 47.5 9.875t47.25
|
||||||
|
30.875q36.75-8.75 77.25-8.75 37 0 70 8 26.25-20.5
|
||||||
|
46.75-30.25t47.25-9.75q12.75 25.5 12.75 54.5 0 21.75-6.75 42 34 40 34
|
||||||
|
99.5z" />
|
||||||
|
</svg>
|
||||||
|
|
||||||
|
</defs>
|
||||||
|
</svg>
|
||||||
|
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
|
||||||
|
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
|
||||||
|
<label class="md-overlay" data-md-component="overlay" for="__drawer"></label>
|
||||||
|
|
||||||
|
<a href="#yq" tabindex="1" class="md-skip">
|
||||||
|
Skip to content
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
<header class="md-header" data-md-component="header">
|
||||||
|
<nav class="md-header-nav md-grid">
|
||||||
|
<div class="md-flex">
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<a href="." title="Yq" class="md-header-nav__button md-logo">
|
||||||
|
|
||||||
|
<i class="md-icon"></i>
|
||||||
|
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<label class="md-icon md-icon--menu md-header-nav__button" for="__drawer"></label>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--stretch">
|
||||||
|
<div class="md-flex__ellipsis md-header-nav__title" data-md-component="title">
|
||||||
|
|
||||||
|
<span class="md-header-nav__topic">
|
||||||
|
Yq
|
||||||
|
</span>
|
||||||
|
<span class="md-header-nav__topic">
|
||||||
|
Install
|
||||||
|
</span>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
|
||||||
|
<label class="md-icon md-icon--search md-header-nav__button" for="__search"></label>
|
||||||
|
|
||||||
|
<div class="md-search" data-md-component="search" role="dialog">
|
||||||
|
<label class="md-search__overlay" for="__search"></label>
|
||||||
|
<div class="md-search__inner" role="search">
|
||||||
|
<form class="md-search__form" name="search">
|
||||||
|
<input type="text" class="md-search__input" name="query" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="query" data-md-state="active">
|
||||||
|
<label class="md-icon md-search__icon" for="__search"></label>
|
||||||
|
<button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1">
|
||||||
|

|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
<div class="md-search__output">
|
||||||
|
<div class="md-search__scrollwrap" data-md-scrollfix>
|
||||||
|
<div class="md-search-result" data-md-component="result">
|
||||||
|
<div class="md-search-result__meta">
|
||||||
|
Type to start searching
|
||||||
|
</div>
|
||||||
|
<ol class="md-search-result__list"></ol>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<div class="md-header-nav__source">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a href="https://github.com/mikefarah/yq/" title="Go to repository" class="md-source" data-md-source="github">
|
||||||
|
|
||||||
|
<div class="md-source__icon">
|
||||||
|
<svg viewBox="0 0 24 24" width="24" height="24">
|
||||||
|
<use xlink:href="#__github" width="24" height="24"></use>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-source__repository">
|
||||||
|
mikefarah/yq
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="md-container">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<main class="md-main">
|
||||||
|
<div class="md-main__inner md-grid" data-md-component="container">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
|
||||||
|
<div class="md-sidebar__scrollwrap">
|
||||||
|
<div class="md-sidebar__inner">
|
||||||
|
<nav class="md-nav md-nav--primary" data-md-level="0">
|
||||||
|
<label class="md-nav__title md-nav__title--site" for="__drawer">
|
||||||
|
<a href="." title="Yq" class="md-nav__button md-logo">
|
||||||
|
|
||||||
|
<i class="md-icon"></i>
|
||||||
|
|
||||||
|
</a>
|
||||||
|
Yq
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<div class="md-nav__source">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a href="https://github.com/mikefarah/yq/" title="Go to repository" class="md-source" data-md-source="github">
|
||||||
|
|
||||||
|
<div class="md-source__icon">
|
||||||
|
<svg viewBox="0 0 24 24" width="24" height="24">
|
||||||
|
<use xlink:href="#__github" width="24" height="24"></use>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-source__repository">
|
||||||
|
mikefarah/yq
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ul class="md-nav__list" data-md-scrollfix>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item md-nav__item--active">
|
||||||
|
|
||||||
|
<input class="md-toggle md-nav__toggle" data-md-toggle="toc" type="checkbox" id="__toc">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<label class="md-nav__link md-nav__link--active" for="__toc">
|
||||||
|
Install
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<a href="." title="Install" class="md-nav__link md-nav__link--active">
|
||||||
|
Install
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
<nav class="md-nav md-nav--secondary">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<label class="md-nav__title" for="__toc">Table of contents</label>
|
||||||
|
<ul class="md-nav__list" data-md-scrollfix>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#install" title="Install" class="md-nav__link">
|
||||||
|
Install
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="read/" title="Read" class="md-nav__link">
|
||||||
|
Read
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="write/" title="Write/Update" class="md-nav__link">
|
||||||
|
Write/Update
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="prefix/" title="Prefix" class="md-nav__link">
|
||||||
|
Prefix
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="delete/" title="Delete" class="md-nav__link">
|
||||||
|
Delete
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="create/" title="Create" class="md-nav__link">
|
||||||
|
Create
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="convert/" title="Convert" class="md-nav__link">
|
||||||
|
Convert
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="merge/" title="Merge" class="md-nav__link">
|
||||||
|
Merge
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
|
||||||
|
<div class="md-sidebar__scrollwrap">
|
||||||
|
<div class="md-sidebar__inner">
|
||||||
|
|
||||||
|
<nav class="md-nav md-nav--secondary">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<label class="md-nav__title" for="__toc">Table of contents</label>
|
||||||
|
<ul class="md-nav__list" data-md-scrollfix>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#install" title="Install" class="md-nav__link">
|
||||||
|
Install
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="md-content">
|
||||||
|
<article class="md-content__inner md-typeset">
|
||||||
|
|
||||||
|
|
||||||
|
<a href="https://github.com/mikefarah/yq/edit/master/docs/index.md" title="Edit this page" class="md-icon md-content__icon"></a>
|
||||||
|
|
||||||
|
|
||||||
|
<h1 id="yq">yq<a class="headerlink" href="#yq" title="Permanent link">¶</a></h1>
|
||||||
|
<p>yq is a lightweight and portable command-line YAML processor</p>
|
||||||
|
<p>The aim of the project is to be the <a href="https://github.com/stedolan/jq">jq</a> or sed of yaml files.</p>
|
||||||
|
<h2 id="install">Install<a class="headerlink" href="#install" title="Permanent link">¶</a></h2>
|
||||||
|
<p>On MacOS:</p>
|
||||||
|
<pre><code>brew install yq
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>On Ubuntu and other Linux distros supporting <code>snap</code> packages:</p>
|
||||||
|
<pre><code>snap install yq
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>On Ubuntu 16.04 or higher from Debian package:</p>
|
||||||
|
<pre><code>sudo add-apt-repository ppa:rmescandon/yq
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install yq -y
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>or, <a href="https://github.com/mikefarah/yq/releases/latest">Download latest binary</a> or alternatively:</p>
|
||||||
|
<pre><code>go get gopkg.in/mikefarah/yq.v2
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/mikefarah/yq">View on GitHub</a></p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
|
||||||
|
<footer class="md-footer">
|
||||||
|
|
||||||
|
<div class="md-footer-nav">
|
||||||
|
<nav class="md-footer-nav__inner md-grid">
|
||||||
|
|
||||||
|
|
||||||
|
<a href="read/" title="Read" class="md-flex md-footer-nav__link md-footer-nav__link--next" rel="next">
|
||||||
|
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
|
||||||
|
<span class="md-flex__ellipsis">
|
||||||
|
<span class="md-footer-nav__direction">
|
||||||
|
Next
|
||||||
|
</span>
|
||||||
|
Read
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<i class="md-icon md-icon--arrow-forward md-footer-nav__button"></i>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-footer-meta md-typeset">
|
||||||
|
<div class="md-footer-meta__inner md-grid">
|
||||||
|
<div class="md-footer-copyright">
|
||||||
|
|
||||||
|
powered by
|
||||||
|
<a href="https://www.mkdocs.org">MkDocs</a>
|
||||||
|
and
|
||||||
|
<a href="https://squidfunk.github.io/mkdocs-material/">
|
||||||
|
Material for MkDocs</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-footer-social">
|
||||||
|
<link rel="stylesheet" href="assets/fonts/font-awesome.css">
|
||||||
|
|
||||||
|
<a href="https://github.com/mikefarah" class="md-footer-social__link fa fa-github"></a>
|
||||||
|
|
||||||
|
<a href="https://www.linkedin.com/in/mike-farah-b5a75b2/" class="md-footer-social__link fa fa-linkedin"></a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="assets/javascripts/application.39abc4af.js"></script>
|
||||||
|
|
||||||
|
<script>app.initialize({version:"1.0.4",url:{base:"."}})</script>
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
730
docs/merge/index.html
Normal file
730
docs/merge/index.html
Normal file
@@ -0,0 +1,730 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="en" class="no-js">
|
||||||
|
<head>
|
||||||
|
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||||
|
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<meta name="lang:clipboard.copy" content="Copy to clipboard">
|
||||||
|
|
||||||
|
<meta name="lang:clipboard.copied" content="Copied to clipboard">
|
||||||
|
|
||||||
|
<meta name="lang:search.language" content="en">
|
||||||
|
|
||||||
|
<meta name="lang:search.pipeline.stopwords" content="True">
|
||||||
|
|
||||||
|
<meta name="lang:search.pipeline.trimmer" content="True">
|
||||||
|
|
||||||
|
<meta name="lang:search.result.none" content="No matching documents">
|
||||||
|
|
||||||
|
<meta name="lang:search.result.one" content="1 matching document">
|
||||||
|
|
||||||
|
<meta name="lang:search.result.other" content="# matching documents">
|
||||||
|
|
||||||
|
<meta name="lang:search.tokenizer" content="[\s\-]+">
|
||||||
|
|
||||||
|
<link rel="shortcut icon" href="../assets/images/favicon.png">
|
||||||
|
<meta name="generator" content="mkdocs-1.0.4, mkdocs-material-4.2.0">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<title>Merge - Yq</title>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="../assets/stylesheets/application.750b69bd.css">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script src="../assets/javascripts/modernizr.74668098.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<link href="https://fonts.gstatic.com" rel="preconnect" crossorigin>
|
||||||
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700|Roboto+Mono">
|
||||||
|
<style>body,input{font-family:"Roboto","Helvetica Neue",Helvetica,Arial,sans-serif}code,kbd,pre{font-family:"Roboto Mono","Courier New",Courier,monospace}</style>
|
||||||
|
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="../assets/fonts/material-icons.css">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body dir="ltr">
|
||||||
|
|
||||||
|
<svg class="md-svg">
|
||||||
|
<defs>
|
||||||
|
|
||||||
|
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="416" height="448"
|
||||||
|
viewBox="0 0 416 448" id="__github">
|
||||||
|
<path fill="currentColor" d="M160 304q0 10-3.125 20.5t-10.75 19-18.125
|
||||||
|
8.5-18.125-8.5-10.75-19-3.125-20.5 3.125-20.5 10.75-19 18.125-8.5
|
||||||
|
18.125 8.5 10.75 19 3.125 20.5zM320 304q0 10-3.125 20.5t-10.75
|
||||||
|
19-18.125 8.5-18.125-8.5-10.75-19-3.125-20.5 3.125-20.5 10.75-19
|
||||||
|
18.125-8.5 18.125 8.5 10.75 19 3.125 20.5zM360
|
||||||
|
304q0-30-17.25-51t-46.75-21q-10.25 0-48.75 5.25-17.75 2.75-39.25
|
||||||
|
2.75t-39.25-2.75q-38-5.25-48.75-5.25-29.5 0-46.75 21t-17.25 51q0 22 8
|
||||||
|
38.375t20.25 25.75 30.5 15 35 7.375 37.25 1.75h42q20.5 0
|
||||||
|
37.25-1.75t35-7.375 30.5-15 20.25-25.75 8-38.375zM416 260q0 51.75-15.25
|
||||||
|
82.75-9.5 19.25-26.375 33.25t-35.25 21.5-42.5 11.875-42.875 5.5-41.75
|
||||||
|
1.125q-19.5 0-35.5-0.75t-36.875-3.125-38.125-7.5-34.25-12.875-30.25-20.25-21.5-28.75q-15.5-30.75-15.5-82.75
|
||||||
|
0-59.25 34-99-6.75-20.5-6.75-42.5 0-29 12.75-54.5 27 0 47.5 9.875t47.25
|
||||||
|
30.875q36.75-8.75 77.25-8.75 37 0 70 8 26.25-20.5
|
||||||
|
46.75-30.25t47.25-9.75q12.75 25.5 12.75 54.5 0 21.75-6.75 42 34 40 34
|
||||||
|
99.5z" />
|
||||||
|
</svg>
|
||||||
|
|
||||||
|
</defs>
|
||||||
|
</svg>
|
||||||
|
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
|
||||||
|
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
|
||||||
|
<label class="md-overlay" data-md-component="overlay" for="__drawer"></label>
|
||||||
|
|
||||||
|
<a href="#to-stdout" tabindex="1" class="md-skip">
|
||||||
|
Skip to content
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
<header class="md-header" data-md-component="header">
|
||||||
|
<nav class="md-header-nav md-grid">
|
||||||
|
<div class="md-flex">
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<a href=".." title="Yq" class="md-header-nav__button md-logo">
|
||||||
|
|
||||||
|
<i class="md-icon"></i>
|
||||||
|
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<label class="md-icon md-icon--menu md-header-nav__button" for="__drawer"></label>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--stretch">
|
||||||
|
<div class="md-flex__ellipsis md-header-nav__title" data-md-component="title">
|
||||||
|
|
||||||
|
<span class="md-header-nav__topic">
|
||||||
|
Yq
|
||||||
|
</span>
|
||||||
|
<span class="md-header-nav__topic">
|
||||||
|
Merge
|
||||||
|
</span>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
|
||||||
|
<label class="md-icon md-icon--search md-header-nav__button" for="__search"></label>
|
||||||
|
|
||||||
|
<div class="md-search" data-md-component="search" role="dialog">
|
||||||
|
<label class="md-search__overlay" for="__search"></label>
|
||||||
|
<div class="md-search__inner" role="search">
|
||||||
|
<form class="md-search__form" name="search">
|
||||||
|
<input type="text" class="md-search__input" name="query" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="query" data-md-state="active">
|
||||||
|
<label class="md-icon md-search__icon" for="__search"></label>
|
||||||
|
<button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1">
|
||||||
|

|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
<div class="md-search__output">
|
||||||
|
<div class="md-search__scrollwrap" data-md-scrollfix>
|
||||||
|
<div class="md-search-result" data-md-component="result">
|
||||||
|
<div class="md-search-result__meta">
|
||||||
|
Type to start searching
|
||||||
|
</div>
|
||||||
|
<ol class="md-search-result__list"></ol>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<div class="md-header-nav__source">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a href="https://github.com/mikefarah/yq/" title="Go to repository" class="md-source" data-md-source="github">
|
||||||
|
|
||||||
|
<div class="md-source__icon">
|
||||||
|
<svg viewBox="0 0 24 24" width="24" height="24">
|
||||||
|
<use xlink:href="#__github" width="24" height="24"></use>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-source__repository">
|
||||||
|
mikefarah/yq
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="md-container">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<main class="md-main">
|
||||||
|
<div class="md-main__inner md-grid" data-md-component="container">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
|
||||||
|
<div class="md-sidebar__scrollwrap">
|
||||||
|
<div class="md-sidebar__inner">
|
||||||
|
<nav class="md-nav md-nav--primary" data-md-level="0">
|
||||||
|
<label class="md-nav__title md-nav__title--site" for="__drawer">
|
||||||
|
<a href=".." title="Yq" class="md-nav__button md-logo">
|
||||||
|
|
||||||
|
<i class="md-icon"></i>
|
||||||
|
|
||||||
|
</a>
|
||||||
|
Yq
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<div class="md-nav__source">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a href="https://github.com/mikefarah/yq/" title="Go to repository" class="md-source" data-md-source="github">
|
||||||
|
|
||||||
|
<div class="md-source__icon">
|
||||||
|
<svg viewBox="0 0 24 24" width="24" height="24">
|
||||||
|
<use xlink:href="#__github" width="24" height="24"></use>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-source__repository">
|
||||||
|
mikefarah/yq
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ul class="md-nav__list" data-md-scrollfix>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href=".." title="Install" class="md-nav__link">
|
||||||
|
Install
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../read/" title="Read" class="md-nav__link">
|
||||||
|
Read
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../write/" title="Write/Update" class="md-nav__link">
|
||||||
|
Write/Update
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../prefix/" title="Prefix" class="md-nav__link">
|
||||||
|
Prefix
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../delete/" title="Delete" class="md-nav__link">
|
||||||
|
Delete
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../create/" title="Create" class="md-nav__link">
|
||||||
|
Create
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../convert/" title="Convert" class="md-nav__link">
|
||||||
|
Convert
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item md-nav__item--active">
|
||||||
|
|
||||||
|
<input class="md-toggle md-nav__toggle" data-md-toggle="toc" type="checkbox" id="__toc">
|
||||||
|
|
||||||
|
|
||||||
|
<label class="md-nav__link md-nav__link--active" for="__toc">
|
||||||
|
Merge
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<a href="./" title="Merge" class="md-nav__link md-nav__link--active">
|
||||||
|
Merge
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
<nav class="md-nav md-nav--secondary">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<label class="md-nav__title" for="__toc">Table of contents</label>
|
||||||
|
<ul class="md-nav__list" data-md-scrollfix>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#to-stdout" title="To Stdout" class="md-nav__link">
|
||||||
|
To Stdout
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#updating-files-in-place" title="Updating files in-place" class="md-nav__link">
|
||||||
|
Updating files in-place
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#overwrite-values" title="Overwrite values" class="md-nav__link">
|
||||||
|
Overwrite values
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#overwrite-values-with-arrays" title="Overwrite values with arrays" class="md-nav__link">
|
||||||
|
Overwrite values with arrays
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#append-values-with-arrays" title="Append values with arrays" class="md-nav__link">
|
||||||
|
Append values with arrays
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#multiple-documents-merge-into-single-document" title="Multiple Documents - merge into single document" class="md-nav__link">
|
||||||
|
Multiple Documents - merge into single document
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#multiple-documents-merge-into-all-documents" title="Multiple Documents - merge into all documents" class="md-nav__link">
|
||||||
|
Multiple Documents - merge into all documents
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
|
||||||
|
<div class="md-sidebar__scrollwrap">
|
||||||
|
<div class="md-sidebar__inner">
|
||||||
|
|
||||||
|
<nav class="md-nav md-nav--secondary">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<label class="md-nav__title" for="__toc">Table of contents</label>
|
||||||
|
<ul class="md-nav__list" data-md-scrollfix>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#to-stdout" title="To Stdout" class="md-nav__link">
|
||||||
|
To Stdout
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#updating-files-in-place" title="Updating files in-place" class="md-nav__link">
|
||||||
|
Updating files in-place
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#overwrite-values" title="Overwrite values" class="md-nav__link">
|
||||||
|
Overwrite values
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#overwrite-values-with-arrays" title="Overwrite values with arrays" class="md-nav__link">
|
||||||
|
Overwrite values with arrays
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#append-values-with-arrays" title="Append values with arrays" class="md-nav__link">
|
||||||
|
Append values with arrays
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#multiple-documents-merge-into-single-document" title="Multiple Documents - merge into single document" class="md-nav__link">
|
||||||
|
Multiple Documents - merge into single document
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#multiple-documents-merge-into-all-documents" title="Multiple Documents - merge into all documents" class="md-nav__link">
|
||||||
|
Multiple Documents - merge into all documents
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="md-content">
|
||||||
|
<article class="md-content__inner md-typeset">
|
||||||
|
|
||||||
|
|
||||||
|
<a href="https://github.com/mikefarah/yq/edit/master/docs/merge.md" title="Edit this page" class="md-icon md-content__icon"></a>
|
||||||
|
|
||||||
|
|
||||||
|
<h1>Merge</h1>
|
||||||
|
|
||||||
|
<p>Yaml files can be merged using the 'merge' command. Each additional file merged with the first file will
|
||||||
|
set values for any key not existing already or where the key has no value.</p>
|
||||||
|
<pre><code>yq m <yaml_file> <path>...
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<h3 id="to-stdout">To Stdout<a class="headerlink" href="#to-stdout" title="Permanent link">¶</a></h3>
|
||||||
|
<p>Given a data1.yaml file of:</p>
|
||||||
|
<pre><code class="yaml">a: simple
|
||||||
|
b: [1, 2]
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>and data2.yaml file of:</p>
|
||||||
|
<pre><code class="yaml">a: other
|
||||||
|
c:
|
||||||
|
test: 1
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>then</p>
|
||||||
|
<pre><code class="bash">yq m data1.yaml data2.yaml
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>will output:</p>
|
||||||
|
<pre><code class="yaml">a: simple
|
||||||
|
b: [1, 2]
|
||||||
|
c:
|
||||||
|
test: 1
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<h3 id="updating-files-in-place">Updating files in-place<a class="headerlink" href="#updating-files-in-place" title="Permanent link">¶</a></h3>
|
||||||
|
<p>Given a data1.yaml file of:</p>
|
||||||
|
<pre><code class="yaml">a: simple
|
||||||
|
b: [1, 2]
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>and data2.yaml file of:</p>
|
||||||
|
<pre><code class="yaml">a: other
|
||||||
|
c:
|
||||||
|
test: 1
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>then</p>
|
||||||
|
<pre><code class="bash">yq m -i data1.yaml data2.yaml
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>will update the data1.yaml file so that the value of 'c' is 'test: 1'.</p>
|
||||||
|
<h3 id="overwrite-values">Overwrite values<a class="headerlink" href="#overwrite-values" title="Permanent link">¶</a></h3>
|
||||||
|
<p>Given a data1.yaml file of:</p>
|
||||||
|
<pre><code class="yaml">a: simple
|
||||||
|
b: [1, 2]
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>and data2.yaml file of:</p>
|
||||||
|
<pre><code class="yaml">a: other
|
||||||
|
c:
|
||||||
|
test: 1
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>then</p>
|
||||||
|
<pre><code class="bash">yq m -x data1.yaml data2.yaml
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>will output:</p>
|
||||||
|
<pre><code class="yaml">a: other
|
||||||
|
b: [1, 2]
|
||||||
|
c:
|
||||||
|
test: 1
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<h3 id="overwrite-values-with-arrays">Overwrite values with arrays<a class="headerlink" href="#overwrite-values-with-arrays" title="Permanent link">¶</a></h3>
|
||||||
|
<p>Given a data1.yaml file of:</p>
|
||||||
|
<pre><code class="yaml">a: simple
|
||||||
|
b: [1, 2]
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>and data3.yaml file of:</p>
|
||||||
|
<pre><code class="yaml">b: [3, 4]
|
||||||
|
c:
|
||||||
|
test: 2
|
||||||
|
other: true
|
||||||
|
d: false
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>then</p>
|
||||||
|
<pre><code class="bash">yq m -x data1.yaml data3.yaml
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>will output:</p>
|
||||||
|
<pre><code class="yaml">a: simple
|
||||||
|
b: [3, 4]
|
||||||
|
c:
|
||||||
|
test: 2
|
||||||
|
other: true
|
||||||
|
d: false
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>Notice that 'b' does not result in the merging of the values within an array. </p>
|
||||||
|
<h3 id="append-values-with-arrays">Append values with arrays<a class="headerlink" href="#append-values-with-arrays" title="Permanent link">¶</a></h3>
|
||||||
|
<p>Given a data1.yaml file of:</p>
|
||||||
|
<pre><code class="yaml">a: simple
|
||||||
|
b: [1, 2]
|
||||||
|
d: hi
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>and data3.yaml file of:</p>
|
||||||
|
<pre><code class="yaml">a: something
|
||||||
|
b: [3, 4]
|
||||||
|
c:
|
||||||
|
test: 2
|
||||||
|
other: true
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>then</p>
|
||||||
|
<pre><code class="bash">yq m -a data1.yaml data3.yaml
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>will output:</p>
|
||||||
|
<pre><code class="yaml">a: simple
|
||||||
|
b: [1, 2, 3, 4]
|
||||||
|
c:
|
||||||
|
test: 2
|
||||||
|
other: true
|
||||||
|
d: hi
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>Note that the 'b' array has concatenated the values from the second data file. Also note that other map keys are not overridden (field a).</p>
|
||||||
|
<p>Append cannot be used with overwrite, if both flags are given then append is ignored.</p>
|
||||||
|
<h3 id="multiple-documents-merge-into-single-document">Multiple Documents - merge into single document<a class="headerlink" href="#multiple-documents-merge-into-single-document" title="Permanent link">¶</a></h3>
|
||||||
|
<p>Currently yq only has multi-document support for the <em>first</em> document being merged into. The remaining yaml files will have their first document selected.</p>
|
||||||
|
<p>Given a data1.yaml file of:</p>
|
||||||
|
<pre><code class="yaml">something: else
|
||||||
|
---
|
||||||
|
a: simple
|
||||||
|
b: cat
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>and data3.yaml file of:</p>
|
||||||
|
<pre><code class="yaml">b: dog
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>then</p>
|
||||||
|
<pre><code class="bash">yq m -x -d1 data1.yaml data3.yaml
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>will output:</p>
|
||||||
|
<pre><code class="yaml">something: else
|
||||||
|
---
|
||||||
|
a: simple
|
||||||
|
b: dog
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<h3 id="multiple-documents-merge-into-all-documents">Multiple Documents - merge into all documents<a class="headerlink" href="#multiple-documents-merge-into-all-documents" title="Permanent link">¶</a></h3>
|
||||||
|
<p>Currently yq only has multi-document support for the <em>first</em> document being merged into. The remaining yaml files will have their first document selected.</p>
|
||||||
|
<p>Given a data1.yaml file of:</p>
|
||||||
|
<pre><code class="yaml">something: else
|
||||||
|
---
|
||||||
|
a: simple
|
||||||
|
b: cat
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>and data3.yaml file of:</p>
|
||||||
|
<pre><code class="yaml">b: dog
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>then</p>
|
||||||
|
<pre><code class="bash">yq m -x -d'*' data1.yaml data3.yaml
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>will output:</p>
|
||||||
|
<pre><code class="yaml">b: dog
|
||||||
|
something: else
|
||||||
|
---
|
||||||
|
a: simple
|
||||||
|
b: dog
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
|
||||||
|
<footer class="md-footer">
|
||||||
|
|
||||||
|
<div class="md-footer-nav">
|
||||||
|
<nav class="md-footer-nav__inner md-grid">
|
||||||
|
|
||||||
|
<a href="../convert/" title="Convert" class="md-flex md-footer-nav__link md-footer-nav__link--prev" rel="prev">
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<i class="md-icon md-icon--arrow-back md-footer-nav__button"></i>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
|
||||||
|
<span class="md-flex__ellipsis">
|
||||||
|
<span class="md-footer-nav__direction">
|
||||||
|
Previous
|
||||||
|
</span>
|
||||||
|
Convert
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-footer-meta md-typeset">
|
||||||
|
<div class="md-footer-meta__inner md-grid">
|
||||||
|
<div class="md-footer-copyright">
|
||||||
|
|
||||||
|
powered by
|
||||||
|
<a href="https://www.mkdocs.org">MkDocs</a>
|
||||||
|
and
|
||||||
|
<a href="https://squidfunk.github.io/mkdocs-material/">
|
||||||
|
Material for MkDocs</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-footer-social">
|
||||||
|
<link rel="stylesheet" href="../assets/fonts/font-awesome.css">
|
||||||
|
|
||||||
|
<a href="https://github.com/mikefarah" class="md-footer-social__link fa fa-github"></a>
|
||||||
|
|
||||||
|
<a href="https://www.linkedin.com/in/mike-farah-b5a75b2/" class="md-footer-social__link fa fa-linkedin"></a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="../assets/javascripts/application.39abc4af.js"></script>
|
||||||
|
|
||||||
|
<script>app.initialize({version:"1.0.4",url:{base:".."}})</script>
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
631
docs/prefix/index.html
Normal file
631
docs/prefix/index.html
Normal file
@@ -0,0 +1,631 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="en" class="no-js">
|
||||||
|
<head>
|
||||||
|
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||||
|
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<meta name="lang:clipboard.copy" content="Copy to clipboard">
|
||||||
|
|
||||||
|
<meta name="lang:clipboard.copied" content="Copied to clipboard">
|
||||||
|
|
||||||
|
<meta name="lang:search.language" content="en">
|
||||||
|
|
||||||
|
<meta name="lang:search.pipeline.stopwords" content="True">
|
||||||
|
|
||||||
|
<meta name="lang:search.pipeline.trimmer" content="True">
|
||||||
|
|
||||||
|
<meta name="lang:search.result.none" content="No matching documents">
|
||||||
|
|
||||||
|
<meta name="lang:search.result.one" content="1 matching document">
|
||||||
|
|
||||||
|
<meta name="lang:search.result.other" content="# matching documents">
|
||||||
|
|
||||||
|
<meta name="lang:search.tokenizer" content="[\s\-]+">
|
||||||
|
|
||||||
|
<link rel="shortcut icon" href="../assets/images/favicon.png">
|
||||||
|
<meta name="generator" content="mkdocs-1.0.4, mkdocs-material-4.2.0">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<title>Prefix - Yq</title>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="../assets/stylesheets/application.750b69bd.css">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script src="../assets/javascripts/modernizr.74668098.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<link href="https://fonts.gstatic.com" rel="preconnect" crossorigin>
|
||||||
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700|Roboto+Mono">
|
||||||
|
<style>body,input{font-family:"Roboto","Helvetica Neue",Helvetica,Arial,sans-serif}code,kbd,pre{font-family:"Roboto Mono","Courier New",Courier,monospace}</style>
|
||||||
|
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="../assets/fonts/material-icons.css">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body dir="ltr">
|
||||||
|
|
||||||
|
<svg class="md-svg">
|
||||||
|
<defs>
|
||||||
|
|
||||||
|
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="416" height="448"
|
||||||
|
viewBox="0 0 416 448" id="__github">
|
||||||
|
<path fill="currentColor" d="M160 304q0 10-3.125 20.5t-10.75 19-18.125
|
||||||
|
8.5-18.125-8.5-10.75-19-3.125-20.5 3.125-20.5 10.75-19 18.125-8.5
|
||||||
|
18.125 8.5 10.75 19 3.125 20.5zM320 304q0 10-3.125 20.5t-10.75
|
||||||
|
19-18.125 8.5-18.125-8.5-10.75-19-3.125-20.5 3.125-20.5 10.75-19
|
||||||
|
18.125-8.5 18.125 8.5 10.75 19 3.125 20.5zM360
|
||||||
|
304q0-30-17.25-51t-46.75-21q-10.25 0-48.75 5.25-17.75 2.75-39.25
|
||||||
|
2.75t-39.25-2.75q-38-5.25-48.75-5.25-29.5 0-46.75 21t-17.25 51q0 22 8
|
||||||
|
38.375t20.25 25.75 30.5 15 35 7.375 37.25 1.75h42q20.5 0
|
||||||
|
37.25-1.75t35-7.375 30.5-15 20.25-25.75 8-38.375zM416 260q0 51.75-15.25
|
||||||
|
82.75-9.5 19.25-26.375 33.25t-35.25 21.5-42.5 11.875-42.875 5.5-41.75
|
||||||
|
1.125q-19.5 0-35.5-0.75t-36.875-3.125-38.125-7.5-34.25-12.875-30.25-20.25-21.5-28.75q-15.5-30.75-15.5-82.75
|
||||||
|
0-59.25 34-99-6.75-20.5-6.75-42.5 0-29 12.75-54.5 27 0 47.5 9.875t47.25
|
||||||
|
30.875q36.75-8.75 77.25-8.75 37 0 70 8 26.25-20.5
|
||||||
|
46.75-30.25t47.25-9.75q12.75 25.5 12.75 54.5 0 21.75-6.75 42 34 40 34
|
||||||
|
99.5z" />
|
||||||
|
</svg>
|
||||||
|
|
||||||
|
</defs>
|
||||||
|
</svg>
|
||||||
|
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
|
||||||
|
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
|
||||||
|
<label class="md-overlay" data-md-component="overlay" for="__drawer"></label>
|
||||||
|
|
||||||
|
<a href="#to-stdout" tabindex="1" class="md-skip">
|
||||||
|
Skip to content
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
<header class="md-header" data-md-component="header">
|
||||||
|
<nav class="md-header-nav md-grid">
|
||||||
|
<div class="md-flex">
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<a href=".." title="Yq" class="md-header-nav__button md-logo">
|
||||||
|
|
||||||
|
<i class="md-icon"></i>
|
||||||
|
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<label class="md-icon md-icon--menu md-header-nav__button" for="__drawer"></label>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--stretch">
|
||||||
|
<div class="md-flex__ellipsis md-header-nav__title" data-md-component="title">
|
||||||
|
|
||||||
|
<span class="md-header-nav__topic">
|
||||||
|
Yq
|
||||||
|
</span>
|
||||||
|
<span class="md-header-nav__topic">
|
||||||
|
Prefix
|
||||||
|
</span>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
|
||||||
|
<label class="md-icon md-icon--search md-header-nav__button" for="__search"></label>
|
||||||
|
|
||||||
|
<div class="md-search" data-md-component="search" role="dialog">
|
||||||
|
<label class="md-search__overlay" for="__search"></label>
|
||||||
|
<div class="md-search__inner" role="search">
|
||||||
|
<form class="md-search__form" name="search">
|
||||||
|
<input type="text" class="md-search__input" name="query" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="query" data-md-state="active">
|
||||||
|
<label class="md-icon md-search__icon" for="__search"></label>
|
||||||
|
<button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1">
|
||||||
|

|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
<div class="md-search__output">
|
||||||
|
<div class="md-search__scrollwrap" data-md-scrollfix>
|
||||||
|
<div class="md-search-result" data-md-component="result">
|
||||||
|
<div class="md-search-result__meta">
|
||||||
|
Type to start searching
|
||||||
|
</div>
|
||||||
|
<ol class="md-search-result__list"></ol>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<div class="md-header-nav__source">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a href="https://github.com/mikefarah/yq/" title="Go to repository" class="md-source" data-md-source="github">
|
||||||
|
|
||||||
|
<div class="md-source__icon">
|
||||||
|
<svg viewBox="0 0 24 24" width="24" height="24">
|
||||||
|
<use xlink:href="#__github" width="24" height="24"></use>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-source__repository">
|
||||||
|
mikefarah/yq
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="md-container">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<main class="md-main">
|
||||||
|
<div class="md-main__inner md-grid" data-md-component="container">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
|
||||||
|
<div class="md-sidebar__scrollwrap">
|
||||||
|
<div class="md-sidebar__inner">
|
||||||
|
<nav class="md-nav md-nav--primary" data-md-level="0">
|
||||||
|
<label class="md-nav__title md-nav__title--site" for="__drawer">
|
||||||
|
<a href=".." title="Yq" class="md-nav__button md-logo">
|
||||||
|
|
||||||
|
<i class="md-icon"></i>
|
||||||
|
|
||||||
|
</a>
|
||||||
|
Yq
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<div class="md-nav__source">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a href="https://github.com/mikefarah/yq/" title="Go to repository" class="md-source" data-md-source="github">
|
||||||
|
|
||||||
|
<div class="md-source__icon">
|
||||||
|
<svg viewBox="0 0 24 24" width="24" height="24">
|
||||||
|
<use xlink:href="#__github" width="24" height="24"></use>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-source__repository">
|
||||||
|
mikefarah/yq
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ul class="md-nav__list" data-md-scrollfix>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href=".." title="Install" class="md-nav__link">
|
||||||
|
Install
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../read/" title="Read" class="md-nav__link">
|
||||||
|
Read
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../write/" title="Write/Update" class="md-nav__link">
|
||||||
|
Write/Update
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item md-nav__item--active">
|
||||||
|
|
||||||
|
<input class="md-toggle md-nav__toggle" data-md-toggle="toc" type="checkbox" id="__toc">
|
||||||
|
|
||||||
|
|
||||||
|
<label class="md-nav__link md-nav__link--active" for="__toc">
|
||||||
|
Prefix
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<a href="./" title="Prefix" class="md-nav__link md-nav__link--active">
|
||||||
|
Prefix
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
<nav class="md-nav md-nav--secondary">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<label class="md-nav__title" for="__toc">Table of contents</label>
|
||||||
|
<ul class="md-nav__list" data-md-scrollfix>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#to-stdout" title="To Stdout" class="md-nav__link">
|
||||||
|
To Stdout
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#arbitrary-depth" title="Arbitrary depth" class="md-nav__link">
|
||||||
|
Arbitrary depth
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#updating-files-in-place" title="Updating files in-place" class="md-nav__link">
|
||||||
|
Updating files in-place
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#multiple-documents-prefix-a-single-document" title="Multiple Documents - prefix a single document" class="md-nav__link">
|
||||||
|
Multiple Documents - prefix a single document
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#multiple-documents-prefix-all-documents" title="Multiple Documents - prefix all documents" class="md-nav__link">
|
||||||
|
Multiple Documents - prefix all documents
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../delete/" title="Delete" class="md-nav__link">
|
||||||
|
Delete
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../create/" title="Create" class="md-nav__link">
|
||||||
|
Create
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../convert/" title="Convert" class="md-nav__link">
|
||||||
|
Convert
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../merge/" title="Merge" class="md-nav__link">
|
||||||
|
Merge
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
|
||||||
|
<div class="md-sidebar__scrollwrap">
|
||||||
|
<div class="md-sidebar__inner">
|
||||||
|
|
||||||
|
<nav class="md-nav md-nav--secondary">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<label class="md-nav__title" for="__toc">Table of contents</label>
|
||||||
|
<ul class="md-nav__list" data-md-scrollfix>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#to-stdout" title="To Stdout" class="md-nav__link">
|
||||||
|
To Stdout
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#arbitrary-depth" title="Arbitrary depth" class="md-nav__link">
|
||||||
|
Arbitrary depth
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#updating-files-in-place" title="Updating files in-place" class="md-nav__link">
|
||||||
|
Updating files in-place
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#multiple-documents-prefix-a-single-document" title="Multiple Documents - prefix a single document" class="md-nav__link">
|
||||||
|
Multiple Documents - prefix a single document
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#multiple-documents-prefix-all-documents" title="Multiple Documents - prefix all documents" class="md-nav__link">
|
||||||
|
Multiple Documents - prefix all documents
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="md-content">
|
||||||
|
<article class="md-content__inner md-typeset">
|
||||||
|
|
||||||
|
|
||||||
|
<a href="https://github.com/mikefarah/yq/edit/master/docs/prefix.md" title="Edit this page" class="md-icon md-content__icon"></a>
|
||||||
|
|
||||||
|
|
||||||
|
<h1>Prefix</h1>
|
||||||
|
|
||||||
|
<p>Paths can be prefixed using the 'prefix' command.
|
||||||
|
The complete yaml content will be nested inside the new prefix path.</p>
|
||||||
|
<pre><code>yq p <yaml_file> <path>
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<h3 id="to-stdout">To Stdout<a class="headerlink" href="#to-stdout" title="Permanent link">¶</a></h3>
|
||||||
|
<p>Given a data1.yaml file of:</p>
|
||||||
|
<pre><code class="yaml">a: simple
|
||||||
|
b: [1, 2]
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>then</p>
|
||||||
|
<pre><code class="bash">yq p data1.yaml c
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>will output:</p>
|
||||||
|
<pre><code class="yaml">c:
|
||||||
|
a: simple
|
||||||
|
b: [1, 2]
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<h3 id="arbitrary-depth">Arbitrary depth<a class="headerlink" href="#arbitrary-depth" title="Permanent link">¶</a></h3>
|
||||||
|
<p>Given a data1.yaml file of:</p>
|
||||||
|
<pre><code class="yaml">a:
|
||||||
|
b: [1, 2]
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>then</p>
|
||||||
|
<pre><code class="bash">yq p data1.yaml c.d
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>will output:</p>
|
||||||
|
<pre><code class="yaml">c:
|
||||||
|
d:
|
||||||
|
a:
|
||||||
|
b: [1, 2]
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<h3 id="updating-files-in-place">Updating files in-place<a class="headerlink" href="#updating-files-in-place" title="Permanent link">¶</a></h3>
|
||||||
|
<p>Given a data1.yaml file of:</p>
|
||||||
|
<pre><code class="yaml">a: simple
|
||||||
|
b: [1, 2]
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>then</p>
|
||||||
|
<pre><code class="bash">yq p -i data1.yaml c
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>will update the data1.yaml file so that the path 'c' is prefixed to all other paths.</p>
|
||||||
|
<h3 id="multiple-documents-prefix-a-single-document">Multiple Documents - prefix a single document<a class="headerlink" href="#multiple-documents-prefix-a-single-document" title="Permanent link">¶</a></h3>
|
||||||
|
<p>Given a data1.yaml file of:</p>
|
||||||
|
<pre><code class="yaml">something: else
|
||||||
|
---
|
||||||
|
a: simple
|
||||||
|
b: cat
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>then</p>
|
||||||
|
<pre><code class="bash">yq p -d1 data1.yaml c
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>will output:</p>
|
||||||
|
<pre><code class="yaml">something: else
|
||||||
|
---
|
||||||
|
c:
|
||||||
|
a: simple
|
||||||
|
b: cat
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<h3 id="multiple-documents-prefix-all-documents">Multiple Documents - prefix all documents<a class="headerlink" href="#multiple-documents-prefix-all-documents" title="Permanent link">¶</a></h3>
|
||||||
|
<p>Given a data1.yaml file of:</p>
|
||||||
|
<pre><code class="yaml">something: else
|
||||||
|
---
|
||||||
|
a: simple
|
||||||
|
b: cat
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>then</p>
|
||||||
|
<pre><code class="bash">yq p -d'*' data1.yaml c
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>will output:</p>
|
||||||
|
<pre><code class="yaml">c:
|
||||||
|
something: else
|
||||||
|
---
|
||||||
|
c:
|
||||||
|
a: simple
|
||||||
|
b: cat
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
|
||||||
|
<footer class="md-footer">
|
||||||
|
|
||||||
|
<div class="md-footer-nav">
|
||||||
|
<nav class="md-footer-nav__inner md-grid">
|
||||||
|
|
||||||
|
<a href="../write/" title="Write/Update" class="md-flex md-footer-nav__link md-footer-nav__link--prev" rel="prev">
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<i class="md-icon md-icon--arrow-back md-footer-nav__button"></i>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
|
||||||
|
<span class="md-flex__ellipsis">
|
||||||
|
<span class="md-footer-nav__direction">
|
||||||
|
Previous
|
||||||
|
</span>
|
||||||
|
Write/Update
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
<a href="../delete/" title="Delete" class="md-flex md-footer-nav__link md-footer-nav__link--next" rel="next">
|
||||||
|
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
|
||||||
|
<span class="md-flex__ellipsis">
|
||||||
|
<span class="md-footer-nav__direction">
|
||||||
|
Next
|
||||||
|
</span>
|
||||||
|
Delete
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<i class="md-icon md-icon--arrow-forward md-footer-nav__button"></i>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-footer-meta md-typeset">
|
||||||
|
<div class="md-footer-meta__inner md-grid">
|
||||||
|
<div class="md-footer-copyright">
|
||||||
|
|
||||||
|
powered by
|
||||||
|
<a href="https://www.mkdocs.org">MkDocs</a>
|
||||||
|
and
|
||||||
|
<a href="https://squidfunk.github.io/mkdocs-material/">
|
||||||
|
Material for MkDocs</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-footer-social">
|
||||||
|
<link rel="stylesheet" href="../assets/fonts/font-awesome.css">
|
||||||
|
|
||||||
|
<a href="https://github.com/mikefarah" class="md-footer-social__link fa fa-github"></a>
|
||||||
|
|
||||||
|
<a href="https://www.linkedin.com/in/mike-farah-b5a75b2/" class="md-footer-social__link fa fa-linkedin"></a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="../assets/javascripts/application.39abc4af.js"></script>
|
||||||
|
|
||||||
|
<script>app.initialize({version:"1.0.4",url:{base:".."}})</script>
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
772
docs/read/index.html
Normal file
772
docs/read/index.html
Normal file
@@ -0,0 +1,772 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="en" class="no-js">
|
||||||
|
<head>
|
||||||
|
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||||
|
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<meta name="lang:clipboard.copy" content="Copy to clipboard">
|
||||||
|
|
||||||
|
<meta name="lang:clipboard.copied" content="Copied to clipboard">
|
||||||
|
|
||||||
|
<meta name="lang:search.language" content="en">
|
||||||
|
|
||||||
|
<meta name="lang:search.pipeline.stopwords" content="True">
|
||||||
|
|
||||||
|
<meta name="lang:search.pipeline.trimmer" content="True">
|
||||||
|
|
||||||
|
<meta name="lang:search.result.none" content="No matching documents">
|
||||||
|
|
||||||
|
<meta name="lang:search.result.one" content="1 matching document">
|
||||||
|
|
||||||
|
<meta name="lang:search.result.other" content="# matching documents">
|
||||||
|
|
||||||
|
<meta name="lang:search.tokenizer" content="[\s\-]+">
|
||||||
|
|
||||||
|
<link rel="shortcut icon" href="../assets/images/favicon.png">
|
||||||
|
<meta name="generator" content="mkdocs-1.0.4, mkdocs-material-4.2.0">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<title>Read - Yq</title>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="../assets/stylesheets/application.750b69bd.css">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script src="../assets/javascripts/modernizr.74668098.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<link href="https://fonts.gstatic.com" rel="preconnect" crossorigin>
|
||||||
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700|Roboto+Mono">
|
||||||
|
<style>body,input{font-family:"Roboto","Helvetica Neue",Helvetica,Arial,sans-serif}code,kbd,pre{font-family:"Roboto Mono","Courier New",Courier,monospace}</style>
|
||||||
|
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="../assets/fonts/material-icons.css">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body dir="ltr">
|
||||||
|
|
||||||
|
<svg class="md-svg">
|
||||||
|
<defs>
|
||||||
|
|
||||||
|
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="416" height="448"
|
||||||
|
viewBox="0 0 416 448" id="__github">
|
||||||
|
<path fill="currentColor" d="M160 304q0 10-3.125 20.5t-10.75 19-18.125
|
||||||
|
8.5-18.125-8.5-10.75-19-3.125-20.5 3.125-20.5 10.75-19 18.125-8.5
|
||||||
|
18.125 8.5 10.75 19 3.125 20.5zM320 304q0 10-3.125 20.5t-10.75
|
||||||
|
19-18.125 8.5-18.125-8.5-10.75-19-3.125-20.5 3.125-20.5 10.75-19
|
||||||
|
18.125-8.5 18.125 8.5 10.75 19 3.125 20.5zM360
|
||||||
|
304q0-30-17.25-51t-46.75-21q-10.25 0-48.75 5.25-17.75 2.75-39.25
|
||||||
|
2.75t-39.25-2.75q-38-5.25-48.75-5.25-29.5 0-46.75 21t-17.25 51q0 22 8
|
||||||
|
38.375t20.25 25.75 30.5 15 35 7.375 37.25 1.75h42q20.5 0
|
||||||
|
37.25-1.75t35-7.375 30.5-15 20.25-25.75 8-38.375zM416 260q0 51.75-15.25
|
||||||
|
82.75-9.5 19.25-26.375 33.25t-35.25 21.5-42.5 11.875-42.875 5.5-41.75
|
||||||
|
1.125q-19.5 0-35.5-0.75t-36.875-3.125-38.125-7.5-34.25-12.875-30.25-20.25-21.5-28.75q-15.5-30.75-15.5-82.75
|
||||||
|
0-59.25 34-99-6.75-20.5-6.75-42.5 0-29 12.75-54.5 27 0 47.5 9.875t47.25
|
||||||
|
30.875q36.75-8.75 77.25-8.75 37 0 70 8 26.25-20.5
|
||||||
|
46.75-30.25t47.25-9.75q12.75 25.5 12.75 54.5 0 21.75-6.75 42 34 40 34
|
||||||
|
99.5z" />
|
||||||
|
</svg>
|
||||||
|
|
||||||
|
</defs>
|
||||||
|
</svg>
|
||||||
|
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
|
||||||
|
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
|
||||||
|
<label class="md-overlay" data-md-component="overlay" for="__drawer"></label>
|
||||||
|
|
||||||
|
<a href="#basic" tabindex="1" class="md-skip">
|
||||||
|
Skip to content
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
<header class="md-header" data-md-component="header">
|
||||||
|
<nav class="md-header-nav md-grid">
|
||||||
|
<div class="md-flex">
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<a href=".." title="Yq" class="md-header-nav__button md-logo">
|
||||||
|
|
||||||
|
<i class="md-icon"></i>
|
||||||
|
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<label class="md-icon md-icon--menu md-header-nav__button" for="__drawer"></label>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--stretch">
|
||||||
|
<div class="md-flex__ellipsis md-header-nav__title" data-md-component="title">
|
||||||
|
|
||||||
|
<span class="md-header-nav__topic">
|
||||||
|
Yq
|
||||||
|
</span>
|
||||||
|
<span class="md-header-nav__topic">
|
||||||
|
Read
|
||||||
|
</span>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
|
||||||
|
<label class="md-icon md-icon--search md-header-nav__button" for="__search"></label>
|
||||||
|
|
||||||
|
<div class="md-search" data-md-component="search" role="dialog">
|
||||||
|
<label class="md-search__overlay" for="__search"></label>
|
||||||
|
<div class="md-search__inner" role="search">
|
||||||
|
<form class="md-search__form" name="search">
|
||||||
|
<input type="text" class="md-search__input" name="query" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="query" data-md-state="active">
|
||||||
|
<label class="md-icon md-search__icon" for="__search"></label>
|
||||||
|
<button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1">
|
||||||
|

|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
<div class="md-search__output">
|
||||||
|
<div class="md-search__scrollwrap" data-md-scrollfix>
|
||||||
|
<div class="md-search-result" data-md-component="result">
|
||||||
|
<div class="md-search-result__meta">
|
||||||
|
Type to start searching
|
||||||
|
</div>
|
||||||
|
<ol class="md-search-result__list"></ol>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<div class="md-header-nav__source">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a href="https://github.com/mikefarah/yq/" title="Go to repository" class="md-source" data-md-source="github">
|
||||||
|
|
||||||
|
<div class="md-source__icon">
|
||||||
|
<svg viewBox="0 0 24 24" width="24" height="24">
|
||||||
|
<use xlink:href="#__github" width="24" height="24"></use>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-source__repository">
|
||||||
|
mikefarah/yq
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="md-container">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<main class="md-main">
|
||||||
|
<div class="md-main__inner md-grid" data-md-component="container">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
|
||||||
|
<div class="md-sidebar__scrollwrap">
|
||||||
|
<div class="md-sidebar__inner">
|
||||||
|
<nav class="md-nav md-nav--primary" data-md-level="0">
|
||||||
|
<label class="md-nav__title md-nav__title--site" for="__drawer">
|
||||||
|
<a href=".." title="Yq" class="md-nav__button md-logo">
|
||||||
|
|
||||||
|
<i class="md-icon"></i>
|
||||||
|
|
||||||
|
</a>
|
||||||
|
Yq
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<div class="md-nav__source">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a href="https://github.com/mikefarah/yq/" title="Go to repository" class="md-source" data-md-source="github">
|
||||||
|
|
||||||
|
<div class="md-source__icon">
|
||||||
|
<svg viewBox="0 0 24 24" width="24" height="24">
|
||||||
|
<use xlink:href="#__github" width="24" height="24"></use>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-source__repository">
|
||||||
|
mikefarah/yq
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ul class="md-nav__list" data-md-scrollfix>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href=".." title="Install" class="md-nav__link">
|
||||||
|
Install
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item md-nav__item--active">
|
||||||
|
|
||||||
|
<input class="md-toggle md-nav__toggle" data-md-toggle="toc" type="checkbox" id="__toc">
|
||||||
|
|
||||||
|
|
||||||
|
<label class="md-nav__link md-nav__link--active" for="__toc">
|
||||||
|
Read
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<a href="./" title="Read" class="md-nav__link md-nav__link--active">
|
||||||
|
Read
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
<nav class="md-nav md-nav--secondary">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<label class="md-nav__title" for="__toc">Table of contents</label>
|
||||||
|
<ul class="md-nav__list" data-md-scrollfix>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#basic" title="Basic" class="md-nav__link">
|
||||||
|
Basic
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#from-stdin" title="From Stdin" class="md-nav__link">
|
||||||
|
From Stdin
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#splat" title="Splat" class="md-nav__link">
|
||||||
|
Splat
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#prefix-splat" title="Prefix Splat" class="md-nav__link">
|
||||||
|
Prefix Splat
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#multiple-documents-specify-a-single-document" title="Multiple Documents - specify a single document" class="md-nav__link">
|
||||||
|
Multiple Documents - specify a single document
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#multiple-documents-read-all-documents" title="Multiple Documents - read all documents" class="md-nav__link">
|
||||||
|
Multiple Documents - read all documents
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#arrays" title="Arrays" class="md-nav__link">
|
||||||
|
Arrays
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#array-splat" title="Array Splat" class="md-nav__link">
|
||||||
|
Array Splat
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#keys-with-dots" title="Keys with dots" class="md-nav__link">
|
||||||
|
Keys with dots
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#keys-and-values-with-leading-dashes" title="Keys (and values) with leading dashes" class="md-nav__link">
|
||||||
|
Keys (and values) with leading dashes
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../write/" title="Write/Update" class="md-nav__link">
|
||||||
|
Write/Update
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../prefix/" title="Prefix" class="md-nav__link">
|
||||||
|
Prefix
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../delete/" title="Delete" class="md-nav__link">
|
||||||
|
Delete
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../create/" title="Create" class="md-nav__link">
|
||||||
|
Create
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../convert/" title="Convert" class="md-nav__link">
|
||||||
|
Convert
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../merge/" title="Merge" class="md-nav__link">
|
||||||
|
Merge
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
|
||||||
|
<div class="md-sidebar__scrollwrap">
|
||||||
|
<div class="md-sidebar__inner">
|
||||||
|
|
||||||
|
<nav class="md-nav md-nav--secondary">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<label class="md-nav__title" for="__toc">Table of contents</label>
|
||||||
|
<ul class="md-nav__list" data-md-scrollfix>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#basic" title="Basic" class="md-nav__link">
|
||||||
|
Basic
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#from-stdin" title="From Stdin" class="md-nav__link">
|
||||||
|
From Stdin
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#splat" title="Splat" class="md-nav__link">
|
||||||
|
Splat
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#prefix-splat" title="Prefix Splat" class="md-nav__link">
|
||||||
|
Prefix Splat
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#multiple-documents-specify-a-single-document" title="Multiple Documents - specify a single document" class="md-nav__link">
|
||||||
|
Multiple Documents - specify a single document
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#multiple-documents-read-all-documents" title="Multiple Documents - read all documents" class="md-nav__link">
|
||||||
|
Multiple Documents - read all documents
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#arrays" title="Arrays" class="md-nav__link">
|
||||||
|
Arrays
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#array-splat" title="Array Splat" class="md-nav__link">
|
||||||
|
Array Splat
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#keys-with-dots" title="Keys with dots" class="md-nav__link">
|
||||||
|
Keys with dots
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#keys-and-values-with-leading-dashes" title="Keys (and values) with leading dashes" class="md-nav__link">
|
||||||
|
Keys (and values) with leading dashes
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="md-content">
|
||||||
|
<article class="md-content__inner md-typeset">
|
||||||
|
|
||||||
|
|
||||||
|
<a href="https://github.com/mikefarah/yq/edit/master/docs/read.md" title="Edit this page" class="md-icon md-content__icon"></a>
|
||||||
|
|
||||||
|
|
||||||
|
<h1>Read</h1>
|
||||||
|
|
||||||
|
<pre><code>yq r <yaml_file|json_file> <path>
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>This command can take a json file as input too, and will output yaml unless specified to export as json (-j)</p>
|
||||||
|
<h3 id="basic">Basic<a class="headerlink" href="#basic" title="Permanent link">¶</a></h3>
|
||||||
|
<p>Given a sample.yaml file of:</p>
|
||||||
|
<pre><code class="yaml">b:
|
||||||
|
c: 2
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>then</p>
|
||||||
|
<pre><code class="bash">yq r sample.yaml b.c
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>will output the value of '2'.</p>
|
||||||
|
<h3 id="from-stdin">From Stdin<a class="headerlink" href="#from-stdin" title="Permanent link">¶</a></h3>
|
||||||
|
<p>Given a sample.yaml file of:</p>
|
||||||
|
<pre><code class="bash">cat sample.yaml | yq r - b.c
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>will output the value of '2'.</p>
|
||||||
|
<h3 id="splat">Splat<a class="headerlink" href="#splat" title="Permanent link">¶</a></h3>
|
||||||
|
<p>Given a sample.yaml file of:</p>
|
||||||
|
<pre><code class="yaml">---
|
||||||
|
bob:
|
||||||
|
item1:
|
||||||
|
cats: bananas
|
||||||
|
item2:
|
||||||
|
cats: apples
|
||||||
|
thing:
|
||||||
|
cats: oranges
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>then</p>
|
||||||
|
<pre><code class="bash">yq r sample.yaml bob.*.cats
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>will output</p>
|
||||||
|
<pre><code class="yaml">- bananas
|
||||||
|
- apples
|
||||||
|
- oranges
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<h3 id="prefix-splat">Prefix Splat<a class="headerlink" href="#prefix-splat" title="Permanent link">¶</a></h3>
|
||||||
|
<p>Given a sample.yaml file of:</p>
|
||||||
|
<pre><code class="yaml">---
|
||||||
|
bob:
|
||||||
|
item1:
|
||||||
|
cats: bananas
|
||||||
|
item2:
|
||||||
|
cats: apples
|
||||||
|
thing:
|
||||||
|
cats: oranges
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>then</p>
|
||||||
|
<pre><code class="bash">yq r sample.yaml bob.item*.cats
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>will output</p>
|
||||||
|
<pre><code class="yaml">- bananas
|
||||||
|
- apples
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<h3 id="multiple-documents-specify-a-single-document">Multiple Documents - specify a single document<a class="headerlink" href="#multiple-documents-specify-a-single-document" title="Permanent link">¶</a></h3>
|
||||||
|
<p>Given a sample.yaml file of:</p>
|
||||||
|
<pre><code class="yaml">something: else
|
||||||
|
---
|
||||||
|
b:
|
||||||
|
c: 2
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>then</p>
|
||||||
|
<pre><code class="bash">yq r -d1 sample.yaml b.c
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>will output the value of '2'.</p>
|
||||||
|
<h3 id="multiple-documents-read-all-documents">Multiple Documents - read all documents<a class="headerlink" href="#multiple-documents-read-all-documents" title="Permanent link">¶</a></h3>
|
||||||
|
<p>Reading all documents will return the result as an array. This can be converted to json using the '-j' flag if desired.</p>
|
||||||
|
<p>Given a sample.yaml file of:</p>
|
||||||
|
<pre><code class="yaml">name: Fred
|
||||||
|
age: 22
|
||||||
|
---
|
||||||
|
name: Stella
|
||||||
|
age: 23
|
||||||
|
---
|
||||||
|
name: Android
|
||||||
|
age: 232
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>then</p>
|
||||||
|
<pre><code class="bash">yq r -d'*' sample.yaml name
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>will output:</p>
|
||||||
|
<pre><code>- Fred
|
||||||
|
- Stella
|
||||||
|
- Android
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<h3 id="arrays">Arrays<a class="headerlink" href="#arrays" title="Permanent link">¶</a></h3>
|
||||||
|
<p>You can give an index to access a specific element:
|
||||||
|
e.g.: given a sample file of</p>
|
||||||
|
<pre><code class="yaml">b:
|
||||||
|
e:
|
||||||
|
- name: fred
|
||||||
|
value: 3
|
||||||
|
- name: sam
|
||||||
|
value: 4
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>then</p>
|
||||||
|
<pre><code>yq r sample.yaml 'b.e[1].name'
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>will output 'sam'</p>
|
||||||
|
<p>Note that the path is in quotes to avoid the square brackets being interpreted by your shell.</p>
|
||||||
|
<h3 id="array-splat">Array Splat<a class="headerlink" href="#array-splat" title="Permanent link">¶</a></h3>
|
||||||
|
<p>e.g.: given a sample file of</p>
|
||||||
|
<pre><code class="yaml">b:
|
||||||
|
e:
|
||||||
|
- name: fred
|
||||||
|
value: 3
|
||||||
|
- name: sam
|
||||||
|
value: 4
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>then</p>
|
||||||
|
<pre><code>yq r sample.yaml 'b.e[*].name'
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>will output:</p>
|
||||||
|
<pre><code>- fred
|
||||||
|
- sam
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>Note that the path is in quotes to avoid the square brackets being interpreted by your shell.</p>
|
||||||
|
<h3 id="keys-with-dots">Keys with dots<a class="headerlink" href="#keys-with-dots" title="Permanent link">¶</a></h3>
|
||||||
|
<p>When specifying a key that has a dot use key lookup indicator.</p>
|
||||||
|
<pre><code class="yaml">b:
|
||||||
|
foo.bar: 7
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<pre><code class="bash">yaml r sample.yaml 'b[foo.bar]'
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<pre><code class="bash">yaml w sample.yaml 'b[foo.bar]' 9
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>Any valid yaml key can be specified as part of a key lookup.</p>
|
||||||
|
<p>Note that the path is in quotes to avoid the square brackets being interpreted by your shell.</p>
|
||||||
|
<h3 id="keys-and-values-with-leading-dashes">Keys (and values) with leading dashes<a class="headerlink" href="#keys-and-values-with-leading-dashes" title="Permanent link">¶</a></h3>
|
||||||
|
<p>If a key or value has leading dashes, yq won't know that you are passing a value as opposed to a flag (and you will get a 'bad flag syntax' error).</p>
|
||||||
|
<p>To fix that, you will need to tell it to stop processing flags by adding '--' after the last flag like so:</p>
|
||||||
|
<pre><code class="bash">yq n -t -- --key --value
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>Will result in</p>
|
||||||
|
<p><code>`
|
||||||
|
--key: --value</code></p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
|
||||||
|
<footer class="md-footer">
|
||||||
|
|
||||||
|
<div class="md-footer-nav">
|
||||||
|
<nav class="md-footer-nav__inner md-grid">
|
||||||
|
|
||||||
|
<a href=".." title="Install" class="md-flex md-footer-nav__link md-footer-nav__link--prev" rel="prev">
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<i class="md-icon md-icon--arrow-back md-footer-nav__button"></i>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
|
||||||
|
<span class="md-flex__ellipsis">
|
||||||
|
<span class="md-footer-nav__direction">
|
||||||
|
Previous
|
||||||
|
</span>
|
||||||
|
Install
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
<a href="../write/" title="Write/Update" class="md-flex md-footer-nav__link md-footer-nav__link--next" rel="next">
|
||||||
|
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
|
||||||
|
<span class="md-flex__ellipsis">
|
||||||
|
<span class="md-footer-nav__direction">
|
||||||
|
Next
|
||||||
|
</span>
|
||||||
|
Write/Update
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<i class="md-icon md-icon--arrow-forward md-footer-nav__button"></i>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-footer-meta md-typeset">
|
||||||
|
<div class="md-footer-meta__inner md-grid">
|
||||||
|
<div class="md-footer-copyright">
|
||||||
|
|
||||||
|
powered by
|
||||||
|
<a href="https://www.mkdocs.org">MkDocs</a>
|
||||||
|
and
|
||||||
|
<a href="https://squidfunk.github.io/mkdocs-material/">
|
||||||
|
Material for MkDocs</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-footer-social">
|
||||||
|
<link rel="stylesheet" href="../assets/fonts/font-awesome.css">
|
||||||
|
|
||||||
|
<a href="https://github.com/mikefarah" class="md-footer-social__link fa fa-github"></a>
|
||||||
|
|
||||||
|
<a href="https://www.linkedin.com/in/mike-farah-b5a75b2/" class="md-footer-social__link fa fa-linkedin"></a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="../assets/javascripts/application.39abc4af.js"></script>
|
||||||
|
|
||||||
|
<script>app.initialize({version:"1.0.4",url:{base:".."}})</script>
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
1
docs/search/search_index.json
Normal file
1
docs/search/search_index.json
Normal file
File diff suppressed because one or more lines are too long
43
docs/sitemap.xml
Normal file
43
docs/sitemap.xml
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||||
|
<url>
|
||||||
|
<loc>None</loc>
|
||||||
|
<lastmod>2019-05-16</lastmod>
|
||||||
|
<changefreq>daily</changefreq>
|
||||||
|
</url>
|
||||||
|
<url>
|
||||||
|
<loc>None</loc>
|
||||||
|
<lastmod>2019-05-16</lastmod>
|
||||||
|
<changefreq>daily</changefreq>
|
||||||
|
</url>
|
||||||
|
<url>
|
||||||
|
<loc>None</loc>
|
||||||
|
<lastmod>2019-05-16</lastmod>
|
||||||
|
<changefreq>daily</changefreq>
|
||||||
|
</url>
|
||||||
|
<url>
|
||||||
|
<loc>None</loc>
|
||||||
|
<lastmod>2019-05-16</lastmod>
|
||||||
|
<changefreq>daily</changefreq>
|
||||||
|
</url>
|
||||||
|
<url>
|
||||||
|
<loc>None</loc>
|
||||||
|
<lastmod>2019-05-16</lastmod>
|
||||||
|
<changefreq>daily</changefreq>
|
||||||
|
</url>
|
||||||
|
<url>
|
||||||
|
<loc>None</loc>
|
||||||
|
<lastmod>2019-05-16</lastmod>
|
||||||
|
<changefreq>daily</changefreq>
|
||||||
|
</url>
|
||||||
|
<url>
|
||||||
|
<loc>None</loc>
|
||||||
|
<lastmod>2019-05-16</lastmod>
|
||||||
|
<changefreq>daily</changefreq>
|
||||||
|
</url>
|
||||||
|
<url>
|
||||||
|
<loc>None</loc>
|
||||||
|
<lastmod>2019-05-16</lastmod>
|
||||||
|
<changefreq>daily</changefreq>
|
||||||
|
</url>
|
||||||
|
</urlset>
|
||||||
BIN
docs/sitemap.xml.gz
Normal file
BIN
docs/sitemap.xml.gz
Normal file
Binary file not shown.
447
docs/snippets/niche/index.html
Normal file
447
docs/snippets/niche/index.html
Normal file
@@ -0,0 +1,447 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="en" class="no-js">
|
||||||
|
<head>
|
||||||
|
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||||
|
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<meta name="lang:clipboard.copy" content="Copy to clipboard">
|
||||||
|
|
||||||
|
<meta name="lang:clipboard.copied" content="Copied to clipboard">
|
||||||
|
|
||||||
|
<meta name="lang:search.language" content="en">
|
||||||
|
|
||||||
|
<meta name="lang:search.pipeline.stopwords" content="True">
|
||||||
|
|
||||||
|
<meta name="lang:search.pipeline.trimmer" content="True">
|
||||||
|
|
||||||
|
<meta name="lang:search.result.none" content="No matching documents">
|
||||||
|
|
||||||
|
<meta name="lang:search.result.one" content="1 matching document">
|
||||||
|
|
||||||
|
<meta name="lang:search.result.other" content="# matching documents">
|
||||||
|
|
||||||
|
<meta name="lang:search.tokenizer" content="[\s\-]+">
|
||||||
|
|
||||||
|
<link rel="shortcut icon" href="../../assets/images/favicon.png">
|
||||||
|
<meta name="generator" content="mkdocs-1.0.4, mkdocs-material-4.2.0">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<title>Niche - Yq</title>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="../../assets/stylesheets/application.750b69bd.css">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script src="../../assets/javascripts/modernizr.74668098.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<link href="https://fonts.gstatic.com" rel="preconnect" crossorigin>
|
||||||
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700|Roboto+Mono">
|
||||||
|
<style>body,input{font-family:"Roboto","Helvetica Neue",Helvetica,Arial,sans-serif}code,kbd,pre{font-family:"Roboto Mono","Courier New",Courier,monospace}</style>
|
||||||
|
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="../../assets/fonts/material-icons.css">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body dir="ltr">
|
||||||
|
|
||||||
|
<svg class="md-svg">
|
||||||
|
<defs>
|
||||||
|
|
||||||
|
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="416" height="448"
|
||||||
|
viewBox="0 0 416 448" id="__github">
|
||||||
|
<path fill="currentColor" d="M160 304q0 10-3.125 20.5t-10.75 19-18.125
|
||||||
|
8.5-18.125-8.5-10.75-19-3.125-20.5 3.125-20.5 10.75-19 18.125-8.5
|
||||||
|
18.125 8.5 10.75 19 3.125 20.5zM320 304q0 10-3.125 20.5t-10.75
|
||||||
|
19-18.125 8.5-18.125-8.5-10.75-19-3.125-20.5 3.125-20.5 10.75-19
|
||||||
|
18.125-8.5 18.125 8.5 10.75 19 3.125 20.5zM360
|
||||||
|
304q0-30-17.25-51t-46.75-21q-10.25 0-48.75 5.25-17.75 2.75-39.25
|
||||||
|
2.75t-39.25-2.75q-38-5.25-48.75-5.25-29.5 0-46.75 21t-17.25 51q0 22 8
|
||||||
|
38.375t20.25 25.75 30.5 15 35 7.375 37.25 1.75h42q20.5 0
|
||||||
|
37.25-1.75t35-7.375 30.5-15 20.25-25.75 8-38.375zM416 260q0 51.75-15.25
|
||||||
|
82.75-9.5 19.25-26.375 33.25t-35.25 21.5-42.5 11.875-42.875 5.5-41.75
|
||||||
|
1.125q-19.5 0-35.5-0.75t-36.875-3.125-38.125-7.5-34.25-12.875-30.25-20.25-21.5-28.75q-15.5-30.75-15.5-82.75
|
||||||
|
0-59.25 34-99-6.75-20.5-6.75-42.5 0-29 12.75-54.5 27 0 47.5 9.875t47.25
|
||||||
|
30.875q36.75-8.75 77.25-8.75 37 0 70 8 26.25-20.5
|
||||||
|
46.75-30.25t47.25-9.75q12.75 25.5 12.75 54.5 0 21.75-6.75 42 34 40 34
|
||||||
|
99.5z" />
|
||||||
|
</svg>
|
||||||
|
|
||||||
|
</defs>
|
||||||
|
</svg>
|
||||||
|
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
|
||||||
|
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
|
||||||
|
<label class="md-overlay" data-md-component="overlay" for="__drawer"></label>
|
||||||
|
|
||||||
|
<a href="#keys-with-dots" tabindex="1" class="md-skip">
|
||||||
|
Skip to content
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
<header class="md-header" data-md-component="header">
|
||||||
|
<nav class="md-header-nav md-grid">
|
||||||
|
<div class="md-flex">
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<a href="../.." title="Yq" class="md-header-nav__button md-logo">
|
||||||
|
|
||||||
|
<i class="md-icon"></i>
|
||||||
|
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<label class="md-icon md-icon--menu md-header-nav__button" for="__drawer"></label>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--stretch">
|
||||||
|
<div class="md-flex__ellipsis md-header-nav__title" data-md-component="title">
|
||||||
|
|
||||||
|
<span class="md-header-nav__topic">
|
||||||
|
Yq
|
||||||
|
</span>
|
||||||
|
<span class="md-header-nav__topic">
|
||||||
|
Niche
|
||||||
|
</span>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
|
||||||
|
<label class="md-icon md-icon--search md-header-nav__button" for="__search"></label>
|
||||||
|
|
||||||
|
<div class="md-search" data-md-component="search" role="dialog">
|
||||||
|
<label class="md-search__overlay" for="__search"></label>
|
||||||
|
<div class="md-search__inner" role="search">
|
||||||
|
<form class="md-search__form" name="search">
|
||||||
|
<input type="text" class="md-search__input" name="query" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="query" data-md-state="active">
|
||||||
|
<label class="md-icon md-search__icon" for="__search"></label>
|
||||||
|
<button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1">
|
||||||
|

|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
<div class="md-search__output">
|
||||||
|
<div class="md-search__scrollwrap" data-md-scrollfix>
|
||||||
|
<div class="md-search-result" data-md-component="result">
|
||||||
|
<div class="md-search-result__meta">
|
||||||
|
Type to start searching
|
||||||
|
</div>
|
||||||
|
<ol class="md-search-result__list"></ol>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<div class="md-header-nav__source">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a href="https://github.com/mikefarah/yq/" title="Go to repository" class="md-source" data-md-source="github">
|
||||||
|
|
||||||
|
<div class="md-source__icon">
|
||||||
|
<svg viewBox="0 0 24 24" width="24" height="24">
|
||||||
|
<use xlink:href="#__github" width="24" height="24"></use>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-source__repository">
|
||||||
|
mikefarah/yq
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="md-container">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<main class="md-main">
|
||||||
|
<div class="md-main__inner md-grid" data-md-component="container">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
|
||||||
|
<div class="md-sidebar__scrollwrap">
|
||||||
|
<div class="md-sidebar__inner">
|
||||||
|
<nav class="md-nav md-nav--primary" data-md-level="0">
|
||||||
|
<label class="md-nav__title md-nav__title--site" for="__drawer">
|
||||||
|
<a href="../.." title="Yq" class="md-nav__button md-logo">
|
||||||
|
|
||||||
|
<i class="md-icon"></i>
|
||||||
|
|
||||||
|
</a>
|
||||||
|
Yq
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<div class="md-nav__source">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a href="https://github.com/mikefarah/yq/" title="Go to repository" class="md-source" data-md-source="github">
|
||||||
|
|
||||||
|
<div class="md-source__icon">
|
||||||
|
<svg viewBox="0 0 24 24" width="24" height="24">
|
||||||
|
<use xlink:href="#__github" width="24" height="24"></use>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-source__repository">
|
||||||
|
mikefarah/yq
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ul class="md-nav__list" data-md-scrollfix>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../.." title="Install" class="md-nav__link">
|
||||||
|
Install
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../../read/" title="Read" class="md-nav__link">
|
||||||
|
Read
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../../write/" title="Write/Update" class="md-nav__link">
|
||||||
|
Write/Update
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../../prefix/" title="Prefix" class="md-nav__link">
|
||||||
|
Prefix
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../../delete/" title="Delete" class="md-nav__link">
|
||||||
|
Delete
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../../create/" title="Create" class="md-nav__link">
|
||||||
|
Create
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../../convert/" title="Convert" class="md-nav__link">
|
||||||
|
Convert
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../../merge/" title="Merge" class="md-nav__link">
|
||||||
|
Merge
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
|
||||||
|
<div class="md-sidebar__scrollwrap">
|
||||||
|
<div class="md-sidebar__inner">
|
||||||
|
|
||||||
|
<nav class="md-nav md-nav--secondary">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<label class="md-nav__title" for="__toc">Table of contents</label>
|
||||||
|
<ul class="md-nav__list" data-md-scrollfix>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#keys-with-dots" title="Keys with dots" class="md-nav__link">
|
||||||
|
Keys with dots
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#keys-and-values-with-leading-dashes" title="Keys (and values) with leading dashes" class="md-nav__link">
|
||||||
|
Keys (and values) with leading dashes
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="md-content">
|
||||||
|
<article class="md-content__inner md-typeset">
|
||||||
|
|
||||||
|
|
||||||
|
<a href="https://github.com/mikefarah/yq/edit/master/docs/snippets/niche.md" title="Edit this page" class="md-icon md-content__icon"></a>
|
||||||
|
|
||||||
|
|
||||||
|
<h1>Niche</h1>
|
||||||
|
|
||||||
|
<h3 id="keys-with-dots">Keys with dots<a class="headerlink" href="#keys-with-dots" title="Permanent link">¶</a></h3>
|
||||||
|
<p>When specifying a key that has a dot use key lookup indicator.</p>
|
||||||
|
<pre><code class="yaml">b:
|
||||||
|
foo.bar: 7
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<pre><code class="bash">yaml r sample.yaml 'b[foo.bar]'
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<pre><code class="bash">yaml w sample.yaml 'b[foo.bar]' 9
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>Any valid yaml key can be specified as part of a key lookup.</p>
|
||||||
|
<p>Note that the path is in quotes to avoid the square brackets being interpreted by your shell.</p>
|
||||||
|
<h3 id="keys-and-values-with-leading-dashes">Keys (and values) with leading dashes<a class="headerlink" href="#keys-and-values-with-leading-dashes" title="Permanent link">¶</a></h3>
|
||||||
|
<p>If a key or value has leading dashes, yq won't know that you are passing a value as opposed to a flag (and you will get a 'bad flag syntax' error).</p>
|
||||||
|
<p>To fix that, you will need to tell it to stop processing flags by adding '--' after the last flag like so:</p>
|
||||||
|
<pre><code class="bash">yq n -t -- --key --value
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>Will result in</p>
|
||||||
|
<pre><code>--key: --value
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
|
||||||
|
<footer class="md-footer">
|
||||||
|
|
||||||
|
<div class="md-footer-meta md-typeset">
|
||||||
|
<div class="md-footer-meta__inner md-grid">
|
||||||
|
<div class="md-footer-copyright">
|
||||||
|
|
||||||
|
powered by
|
||||||
|
<a href="https://www.mkdocs.org">MkDocs</a>
|
||||||
|
and
|
||||||
|
<a href="https://squidfunk.github.io/mkdocs-material/">
|
||||||
|
Material for MkDocs</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-footer-social">
|
||||||
|
<link rel="stylesheet" href="../../assets/fonts/font-awesome.css">
|
||||||
|
|
||||||
|
<a href="https://github.com/mikefarah" class="md-footer-social__link fa fa-github"></a>
|
||||||
|
|
||||||
|
<a href="https://www.linkedin.com/in/mike-farah-b5a75b2/" class="md-footer-social__link fa fa-linkedin"></a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="../../assets/javascripts/application.39abc4af.js"></script>
|
||||||
|
|
||||||
|
<script>app.initialize({version:"1.0.4",url:{base:"../.."}})</script>
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
385
docs/snippets/works_with_json/index.html
Normal file
385
docs/snippets/works_with_json/index.html
Normal file
@@ -0,0 +1,385 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="en" class="no-js">
|
||||||
|
<head>
|
||||||
|
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||||
|
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<meta name="lang:clipboard.copy" content="Copy to clipboard">
|
||||||
|
|
||||||
|
<meta name="lang:clipboard.copied" content="Copied to clipboard">
|
||||||
|
|
||||||
|
<meta name="lang:search.language" content="en">
|
||||||
|
|
||||||
|
<meta name="lang:search.pipeline.stopwords" content="True">
|
||||||
|
|
||||||
|
<meta name="lang:search.pipeline.trimmer" content="True">
|
||||||
|
|
||||||
|
<meta name="lang:search.result.none" content="No matching documents">
|
||||||
|
|
||||||
|
<meta name="lang:search.result.one" content="1 matching document">
|
||||||
|
|
||||||
|
<meta name="lang:search.result.other" content="# matching documents">
|
||||||
|
|
||||||
|
<meta name="lang:search.tokenizer" content="[\s\-]+">
|
||||||
|
|
||||||
|
<link rel="shortcut icon" href="../../assets/images/favicon.png">
|
||||||
|
<meta name="generator" content="mkdocs-1.0.4, mkdocs-material-4.2.0">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<title>Works with json - Yq</title>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="../../assets/stylesheets/application.750b69bd.css">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script src="../../assets/javascripts/modernizr.74668098.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<link href="https://fonts.gstatic.com" rel="preconnect" crossorigin>
|
||||||
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700|Roboto+Mono">
|
||||||
|
<style>body,input{font-family:"Roboto","Helvetica Neue",Helvetica,Arial,sans-serif}code,kbd,pre{font-family:"Roboto Mono","Courier New",Courier,monospace}</style>
|
||||||
|
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="../../assets/fonts/material-icons.css">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body dir="ltr">
|
||||||
|
|
||||||
|
<svg class="md-svg">
|
||||||
|
<defs>
|
||||||
|
|
||||||
|
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="416" height="448"
|
||||||
|
viewBox="0 0 416 448" id="__github">
|
||||||
|
<path fill="currentColor" d="M160 304q0 10-3.125 20.5t-10.75 19-18.125
|
||||||
|
8.5-18.125-8.5-10.75-19-3.125-20.5 3.125-20.5 10.75-19 18.125-8.5
|
||||||
|
18.125 8.5 10.75 19 3.125 20.5zM320 304q0 10-3.125 20.5t-10.75
|
||||||
|
19-18.125 8.5-18.125-8.5-10.75-19-3.125-20.5 3.125-20.5 10.75-19
|
||||||
|
18.125-8.5 18.125 8.5 10.75 19 3.125 20.5zM360
|
||||||
|
304q0-30-17.25-51t-46.75-21q-10.25 0-48.75 5.25-17.75 2.75-39.25
|
||||||
|
2.75t-39.25-2.75q-38-5.25-48.75-5.25-29.5 0-46.75 21t-17.25 51q0 22 8
|
||||||
|
38.375t20.25 25.75 30.5 15 35 7.375 37.25 1.75h42q20.5 0
|
||||||
|
37.25-1.75t35-7.375 30.5-15 20.25-25.75 8-38.375zM416 260q0 51.75-15.25
|
||||||
|
82.75-9.5 19.25-26.375 33.25t-35.25 21.5-42.5 11.875-42.875 5.5-41.75
|
||||||
|
1.125q-19.5 0-35.5-0.75t-36.875-3.125-38.125-7.5-34.25-12.875-30.25-20.25-21.5-28.75q-15.5-30.75-15.5-82.75
|
||||||
|
0-59.25 34-99-6.75-20.5-6.75-42.5 0-29 12.75-54.5 27 0 47.5 9.875t47.25
|
||||||
|
30.875q36.75-8.75 77.25-8.75 37 0 70 8 26.25-20.5
|
||||||
|
46.75-30.25t47.25-9.75q12.75 25.5 12.75 54.5 0 21.75-6.75 42 34 40 34
|
||||||
|
99.5z" />
|
||||||
|
</svg>
|
||||||
|
|
||||||
|
</defs>
|
||||||
|
</svg>
|
||||||
|
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
|
||||||
|
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
|
||||||
|
<label class="md-overlay" data-md-component="overlay" for="__drawer"></label>
|
||||||
|
|
||||||
|
|
||||||
|
<header class="md-header" data-md-component="header">
|
||||||
|
<nav class="md-header-nav md-grid">
|
||||||
|
<div class="md-flex">
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<a href="../.." title="Yq" class="md-header-nav__button md-logo">
|
||||||
|
|
||||||
|
<i class="md-icon"></i>
|
||||||
|
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<label class="md-icon md-icon--menu md-header-nav__button" for="__drawer"></label>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--stretch">
|
||||||
|
<div class="md-flex__ellipsis md-header-nav__title" data-md-component="title">
|
||||||
|
|
||||||
|
<span class="md-header-nav__topic">
|
||||||
|
Yq
|
||||||
|
</span>
|
||||||
|
<span class="md-header-nav__topic">
|
||||||
|
Works with json
|
||||||
|
</span>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
|
||||||
|
<label class="md-icon md-icon--search md-header-nav__button" for="__search"></label>
|
||||||
|
|
||||||
|
<div class="md-search" data-md-component="search" role="dialog">
|
||||||
|
<label class="md-search__overlay" for="__search"></label>
|
||||||
|
<div class="md-search__inner" role="search">
|
||||||
|
<form class="md-search__form" name="search">
|
||||||
|
<input type="text" class="md-search__input" name="query" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="query" data-md-state="active">
|
||||||
|
<label class="md-icon md-search__icon" for="__search"></label>
|
||||||
|
<button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1">
|
||||||
|

|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
<div class="md-search__output">
|
||||||
|
<div class="md-search__scrollwrap" data-md-scrollfix>
|
||||||
|
<div class="md-search-result" data-md-component="result">
|
||||||
|
<div class="md-search-result__meta">
|
||||||
|
Type to start searching
|
||||||
|
</div>
|
||||||
|
<ol class="md-search-result__list"></ol>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<div class="md-header-nav__source">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a href="https://github.com/mikefarah/yq/" title="Go to repository" class="md-source" data-md-source="github">
|
||||||
|
|
||||||
|
<div class="md-source__icon">
|
||||||
|
<svg viewBox="0 0 24 24" width="24" height="24">
|
||||||
|
<use xlink:href="#__github" width="24" height="24"></use>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-source__repository">
|
||||||
|
mikefarah/yq
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="md-container">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<main class="md-main">
|
||||||
|
<div class="md-main__inner md-grid" data-md-component="container">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
|
||||||
|
<div class="md-sidebar__scrollwrap">
|
||||||
|
<div class="md-sidebar__inner">
|
||||||
|
<nav class="md-nav md-nav--primary" data-md-level="0">
|
||||||
|
<label class="md-nav__title md-nav__title--site" for="__drawer">
|
||||||
|
<a href="../.." title="Yq" class="md-nav__button md-logo">
|
||||||
|
|
||||||
|
<i class="md-icon"></i>
|
||||||
|
|
||||||
|
</a>
|
||||||
|
Yq
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<div class="md-nav__source">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a href="https://github.com/mikefarah/yq/" title="Go to repository" class="md-source" data-md-source="github">
|
||||||
|
|
||||||
|
<div class="md-source__icon">
|
||||||
|
<svg viewBox="0 0 24 24" width="24" height="24">
|
||||||
|
<use xlink:href="#__github" width="24" height="24"></use>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-source__repository">
|
||||||
|
mikefarah/yq
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ul class="md-nav__list" data-md-scrollfix>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../.." title="Install" class="md-nav__link">
|
||||||
|
Install
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../../read/" title="Read" class="md-nav__link">
|
||||||
|
Read
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../../write/" title="Write/Update" class="md-nav__link">
|
||||||
|
Write/Update
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../../prefix/" title="Prefix" class="md-nav__link">
|
||||||
|
Prefix
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../../delete/" title="Delete" class="md-nav__link">
|
||||||
|
Delete
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../../create/" title="Create" class="md-nav__link">
|
||||||
|
Create
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../../convert/" title="Convert" class="md-nav__link">
|
||||||
|
Convert
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../../merge/" title="Merge" class="md-nav__link">
|
||||||
|
Merge
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="md-content">
|
||||||
|
<article class="md-content__inner md-typeset">
|
||||||
|
|
||||||
|
|
||||||
|
<a href="https://github.com/mikefarah/yq/edit/master/docs/snippets/works_with_json.md" title="Edit this page" class="md-icon md-content__icon"></a>
|
||||||
|
|
||||||
|
|
||||||
|
<h1>Works with json</h1>
|
||||||
|
|
||||||
|
<p>This command can take a json file as input too, and will output yaml unless specified to export as json (-j)</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
|
||||||
|
<footer class="md-footer">
|
||||||
|
|
||||||
|
<div class="md-footer-meta md-typeset">
|
||||||
|
<div class="md-footer-meta__inner md-grid">
|
||||||
|
<div class="md-footer-copyright">
|
||||||
|
|
||||||
|
powered by
|
||||||
|
<a href="https://www.mkdocs.org">MkDocs</a>
|
||||||
|
and
|
||||||
|
<a href="https://squidfunk.github.io/mkdocs-material/">
|
||||||
|
Material for MkDocs</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-footer-social">
|
||||||
|
<link rel="stylesheet" href="../../assets/fonts/font-awesome.css">
|
||||||
|
|
||||||
|
<a href="https://github.com/mikefarah" class="md-footer-social__link fa fa-github"></a>
|
||||||
|
|
||||||
|
<a href="https://www.linkedin.com/in/mike-farah-b5a75b2/" class="md-footer-social__link fa fa-linkedin"></a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="../../assets/javascripts/application.39abc4af.js"></script>
|
||||||
|
|
||||||
|
<script>app.initialize({version:"1.0.4",url:{base:"../.."}})</script>
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
919
docs/write/index.html
Normal file
919
docs/write/index.html
Normal file
@@ -0,0 +1,919 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="en" class="no-js">
|
||||||
|
<head>
|
||||||
|
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||||
|
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<meta name="lang:clipboard.copy" content="Copy to clipboard">
|
||||||
|
|
||||||
|
<meta name="lang:clipboard.copied" content="Copied to clipboard">
|
||||||
|
|
||||||
|
<meta name="lang:search.language" content="en">
|
||||||
|
|
||||||
|
<meta name="lang:search.pipeline.stopwords" content="True">
|
||||||
|
|
||||||
|
<meta name="lang:search.pipeline.trimmer" content="True">
|
||||||
|
|
||||||
|
<meta name="lang:search.result.none" content="No matching documents">
|
||||||
|
|
||||||
|
<meta name="lang:search.result.one" content="1 matching document">
|
||||||
|
|
||||||
|
<meta name="lang:search.result.other" content="# matching documents">
|
||||||
|
|
||||||
|
<meta name="lang:search.tokenizer" content="[\s\-]+">
|
||||||
|
|
||||||
|
<link rel="shortcut icon" href="../assets/images/favicon.png">
|
||||||
|
<meta name="generator" content="mkdocs-1.0.4, mkdocs-material-4.2.0">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<title>Write/Update - Yq</title>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="../assets/stylesheets/application.750b69bd.css">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script src="../assets/javascripts/modernizr.74668098.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<link href="https://fonts.gstatic.com" rel="preconnect" crossorigin>
|
||||||
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700|Roboto+Mono">
|
||||||
|
<style>body,input{font-family:"Roboto","Helvetica Neue",Helvetica,Arial,sans-serif}code,kbd,pre{font-family:"Roboto Mono","Courier New",Courier,monospace}</style>
|
||||||
|
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="../assets/fonts/material-icons.css">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body dir="ltr">
|
||||||
|
|
||||||
|
<svg class="md-svg">
|
||||||
|
<defs>
|
||||||
|
|
||||||
|
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="416" height="448"
|
||||||
|
viewBox="0 0 416 448" id="__github">
|
||||||
|
<path fill="currentColor" d="M160 304q0 10-3.125 20.5t-10.75 19-18.125
|
||||||
|
8.5-18.125-8.5-10.75-19-3.125-20.5 3.125-20.5 10.75-19 18.125-8.5
|
||||||
|
18.125 8.5 10.75 19 3.125 20.5zM320 304q0 10-3.125 20.5t-10.75
|
||||||
|
19-18.125 8.5-18.125-8.5-10.75-19-3.125-20.5 3.125-20.5 10.75-19
|
||||||
|
18.125-8.5 18.125 8.5 10.75 19 3.125 20.5zM360
|
||||||
|
304q0-30-17.25-51t-46.75-21q-10.25 0-48.75 5.25-17.75 2.75-39.25
|
||||||
|
2.75t-39.25-2.75q-38-5.25-48.75-5.25-29.5 0-46.75 21t-17.25 51q0 22 8
|
||||||
|
38.375t20.25 25.75 30.5 15 35 7.375 37.25 1.75h42q20.5 0
|
||||||
|
37.25-1.75t35-7.375 30.5-15 20.25-25.75 8-38.375zM416 260q0 51.75-15.25
|
||||||
|
82.75-9.5 19.25-26.375 33.25t-35.25 21.5-42.5 11.875-42.875 5.5-41.75
|
||||||
|
1.125q-19.5 0-35.5-0.75t-36.875-3.125-38.125-7.5-34.25-12.875-30.25-20.25-21.5-28.75q-15.5-30.75-15.5-82.75
|
||||||
|
0-59.25 34-99-6.75-20.5-6.75-42.5 0-29 12.75-54.5 27 0 47.5 9.875t47.25
|
||||||
|
30.875q36.75-8.75 77.25-8.75 37 0 70 8 26.25-20.5
|
||||||
|
46.75-30.25t47.25-9.75q12.75 25.5 12.75 54.5 0 21.75-6.75 42 34 40 34
|
||||||
|
99.5z" />
|
||||||
|
</svg>
|
||||||
|
|
||||||
|
</defs>
|
||||||
|
</svg>
|
||||||
|
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
|
||||||
|
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
|
||||||
|
<label class="md-overlay" data-md-component="overlay" for="__drawer"></label>
|
||||||
|
|
||||||
|
<a href="#to-stdout" tabindex="1" class="md-skip">
|
||||||
|
Skip to content
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
<header class="md-header" data-md-component="header">
|
||||||
|
<nav class="md-header-nav md-grid">
|
||||||
|
<div class="md-flex">
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<a href=".." title="Yq" class="md-header-nav__button md-logo">
|
||||||
|
|
||||||
|
<i class="md-icon"></i>
|
||||||
|
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<label class="md-icon md-icon--menu md-header-nav__button" for="__drawer"></label>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--stretch">
|
||||||
|
<div class="md-flex__ellipsis md-header-nav__title" data-md-component="title">
|
||||||
|
|
||||||
|
<span class="md-header-nav__topic">
|
||||||
|
Yq
|
||||||
|
</span>
|
||||||
|
<span class="md-header-nav__topic">
|
||||||
|
Write/Update
|
||||||
|
</span>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
|
||||||
|
<label class="md-icon md-icon--search md-header-nav__button" for="__search"></label>
|
||||||
|
|
||||||
|
<div class="md-search" data-md-component="search" role="dialog">
|
||||||
|
<label class="md-search__overlay" for="__search"></label>
|
||||||
|
<div class="md-search__inner" role="search">
|
||||||
|
<form class="md-search__form" name="search">
|
||||||
|
<input type="text" class="md-search__input" name="query" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="query" data-md-state="active">
|
||||||
|
<label class="md-icon md-search__icon" for="__search"></label>
|
||||||
|
<button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1">
|
||||||
|

|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
<div class="md-search__output">
|
||||||
|
<div class="md-search__scrollwrap" data-md-scrollfix>
|
||||||
|
<div class="md-search-result" data-md-component="result">
|
||||||
|
<div class="md-search-result__meta">
|
||||||
|
Type to start searching
|
||||||
|
</div>
|
||||||
|
<ol class="md-search-result__list"></ol>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<div class="md-header-nav__source">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a href="https://github.com/mikefarah/yq/" title="Go to repository" class="md-source" data-md-source="github">
|
||||||
|
|
||||||
|
<div class="md-source__icon">
|
||||||
|
<svg viewBox="0 0 24 24" width="24" height="24">
|
||||||
|
<use xlink:href="#__github" width="24" height="24"></use>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-source__repository">
|
||||||
|
mikefarah/yq
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="md-container">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<main class="md-main">
|
||||||
|
<div class="md-main__inner md-grid" data-md-component="container">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
|
||||||
|
<div class="md-sidebar__scrollwrap">
|
||||||
|
<div class="md-sidebar__inner">
|
||||||
|
<nav class="md-nav md-nav--primary" data-md-level="0">
|
||||||
|
<label class="md-nav__title md-nav__title--site" for="__drawer">
|
||||||
|
<a href=".." title="Yq" class="md-nav__button md-logo">
|
||||||
|
|
||||||
|
<i class="md-icon"></i>
|
||||||
|
|
||||||
|
</a>
|
||||||
|
Yq
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<div class="md-nav__source">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a href="https://github.com/mikefarah/yq/" title="Go to repository" class="md-source" data-md-source="github">
|
||||||
|
|
||||||
|
<div class="md-source__icon">
|
||||||
|
<svg viewBox="0 0 24 24" width="24" height="24">
|
||||||
|
<use xlink:href="#__github" width="24" height="24"></use>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-source__repository">
|
||||||
|
mikefarah/yq
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ul class="md-nav__list" data-md-scrollfix>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href=".." title="Install" class="md-nav__link">
|
||||||
|
Install
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../read/" title="Read" class="md-nav__link">
|
||||||
|
Read
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item md-nav__item--active">
|
||||||
|
|
||||||
|
<input class="md-toggle md-nav__toggle" data-md-toggle="toc" type="checkbox" id="__toc">
|
||||||
|
|
||||||
|
|
||||||
|
<label class="md-nav__link md-nav__link--active" for="__toc">
|
||||||
|
Write/Update
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<a href="./" title="Write/Update" class="md-nav__link md-nav__link--active">
|
||||||
|
Write/Update
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
<nav class="md-nav md-nav--secondary">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<label class="md-nav__title" for="__toc">Table of contents</label>
|
||||||
|
<ul class="md-nav__list" data-md-scrollfix>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#to-stdout" title="To Stdout" class="md-nav__link">
|
||||||
|
To Stdout
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#from-stdin" title="From STDIN" class="md-nav__link">
|
||||||
|
From STDIN
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#adding-new-fields" title="Adding new fields" class="md-nav__link">
|
||||||
|
Adding new fields
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#splat" title="Splat" class="md-nav__link">
|
||||||
|
Splat
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#prefix-splat" title="Prefix Splat" class="md-nav__link">
|
||||||
|
Prefix Splat
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#array-splat" title="Array Splat" class="md-nav__link">
|
||||||
|
Array Splat
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#appending-value-to-an-array-field" title="Appending value to an array field" class="md-nav__link">
|
||||||
|
Appending value to an array field
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#multiple-documents-update-a-single-document" title="Multiple Documents - update a single document" class="md-nav__link">
|
||||||
|
Multiple Documents - update a single document
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#multiple-documents-update-all-documents" title="Multiple Documents - update all documents" class="md-nav__link">
|
||||||
|
Multiple Documents - update all documents
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#updating-files-in-place" title="Updating files in-place" class="md-nav__link">
|
||||||
|
Updating files in-place
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#updating-multiple-values-with-a-script" title="Updating multiple values with a script" class="md-nav__link">
|
||||||
|
Updating multiple values with a script
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#values-starting-with-a-hyphen-or-dash" title="Values starting with a hyphen (or dash)" class="md-nav__link">
|
||||||
|
Values starting with a hyphen (or dash)
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#keys-with-dots" title="Keys with dots" class="md-nav__link">
|
||||||
|
Keys with dots
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#keys-and-values-with-leading-dashes" title="Keys (and values) with leading dashes" class="md-nav__link">
|
||||||
|
Keys (and values) with leading dashes
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../prefix/" title="Prefix" class="md-nav__link">
|
||||||
|
Prefix
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../delete/" title="Delete" class="md-nav__link">
|
||||||
|
Delete
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../create/" title="Create" class="md-nav__link">
|
||||||
|
Create
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../convert/" title="Convert" class="md-nav__link">
|
||||||
|
Convert
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="../merge/" title="Merge" class="md-nav__link">
|
||||||
|
Merge
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
|
||||||
|
<div class="md-sidebar__scrollwrap">
|
||||||
|
<div class="md-sidebar__inner">
|
||||||
|
|
||||||
|
<nav class="md-nav md-nav--secondary">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<label class="md-nav__title" for="__toc">Table of contents</label>
|
||||||
|
<ul class="md-nav__list" data-md-scrollfix>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#to-stdout" title="To Stdout" class="md-nav__link">
|
||||||
|
To Stdout
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#from-stdin" title="From STDIN" class="md-nav__link">
|
||||||
|
From STDIN
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#adding-new-fields" title="Adding new fields" class="md-nav__link">
|
||||||
|
Adding new fields
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#splat" title="Splat" class="md-nav__link">
|
||||||
|
Splat
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#prefix-splat" title="Prefix Splat" class="md-nav__link">
|
||||||
|
Prefix Splat
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#array-splat" title="Array Splat" class="md-nav__link">
|
||||||
|
Array Splat
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#appending-value-to-an-array-field" title="Appending value to an array field" class="md-nav__link">
|
||||||
|
Appending value to an array field
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#multiple-documents-update-a-single-document" title="Multiple Documents - update a single document" class="md-nav__link">
|
||||||
|
Multiple Documents - update a single document
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#multiple-documents-update-all-documents" title="Multiple Documents - update all documents" class="md-nav__link">
|
||||||
|
Multiple Documents - update all documents
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#updating-files-in-place" title="Updating files in-place" class="md-nav__link">
|
||||||
|
Updating files in-place
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#updating-multiple-values-with-a-script" title="Updating multiple values with a script" class="md-nav__link">
|
||||||
|
Updating multiple values with a script
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#values-starting-with-a-hyphen-or-dash" title="Values starting with a hyphen (or dash)" class="md-nav__link">
|
||||||
|
Values starting with a hyphen (or dash)
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#keys-with-dots" title="Keys with dots" class="md-nav__link">
|
||||||
|
Keys with dots
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="md-nav__item">
|
||||||
|
<a href="#keys-and-values-with-leading-dashes" title="Keys (and values) with leading dashes" class="md-nav__link">
|
||||||
|
Keys (and values) with leading dashes
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="md-content">
|
||||||
|
<article class="md-content__inner md-typeset">
|
||||||
|
|
||||||
|
|
||||||
|
<a href="https://github.com/mikefarah/yq/edit/master/docs/write.md" title="Edit this page" class="md-icon md-content__icon"></a>
|
||||||
|
|
||||||
|
|
||||||
|
<h1>Write/Update</h1>
|
||||||
|
|
||||||
|
<pre><code>yq w <yaml_file> <path> <new value>
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<h3 id="to-stdout">To Stdout<a class="headerlink" href="#to-stdout" title="Permanent link">¶</a></h3>
|
||||||
|
<p>Given a sample.yaml file of:</p>
|
||||||
|
<pre><code class="yaml">b:
|
||||||
|
c: 2
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>then</p>
|
||||||
|
<pre><code class="bash">yq w sample.yaml b.c cat
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>will output:</p>
|
||||||
|
<pre><code class="yaml">b:
|
||||||
|
c: cat
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<h3 id="from-stdin">From STDIN<a class="headerlink" href="#from-stdin" title="Permanent link">¶</a></h3>
|
||||||
|
<pre><code class="bash">cat sample.yaml | yq w - b.c blah
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<h3 id="adding-new-fields">Adding new fields<a class="headerlink" href="#adding-new-fields" title="Permanent link">¶</a></h3>
|
||||||
|
<p>Any missing fields in the path will be created on the fly.</p>
|
||||||
|
<p>Given a sample.yaml file of:</p>
|
||||||
|
<pre><code class="yaml">b:
|
||||||
|
c: 2
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>then</p>
|
||||||
|
<pre><code class="bash">yq w sample.yaml b.d[+] "new thing"
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>will output:</p>
|
||||||
|
<pre><code class="yaml">b:
|
||||||
|
c: cat
|
||||||
|
d:
|
||||||
|
- new thing
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<h3 id="splat">Splat<a class="headerlink" href="#splat" title="Permanent link">¶</a></h3>
|
||||||
|
<p>Given a sample.yaml file of:</p>
|
||||||
|
<pre><code class="yaml">---
|
||||||
|
bob:
|
||||||
|
item1:
|
||||||
|
cats: bananas
|
||||||
|
item2:
|
||||||
|
cats: apples
|
||||||
|
thing:
|
||||||
|
cats: oranges
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>then</p>
|
||||||
|
<pre><code class="bash">yq w sample.yaml bob.*.cats meow
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>will output:</p>
|
||||||
|
<pre><code class="yaml">---
|
||||||
|
bob:
|
||||||
|
item1:
|
||||||
|
cats: meow
|
||||||
|
item2:
|
||||||
|
cats: meow
|
||||||
|
thing:
|
||||||
|
cats: meow
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<h3 id="prefix-splat">Prefix Splat<a class="headerlink" href="#prefix-splat" title="Permanent link">¶</a></h3>
|
||||||
|
<p>Given a sample.yaml file of:</p>
|
||||||
|
<pre><code class="yaml">---
|
||||||
|
bob:
|
||||||
|
item1:
|
||||||
|
cats: bananas
|
||||||
|
item2:
|
||||||
|
cats: apples
|
||||||
|
thing:
|
||||||
|
cats: oranges
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>then</p>
|
||||||
|
<pre><code class="bash">yq w sample.yaml bob.item*.cats meow
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>will output:</p>
|
||||||
|
<pre><code class="yaml">---
|
||||||
|
bob:
|
||||||
|
item1:
|
||||||
|
cats: meow
|
||||||
|
item2:
|
||||||
|
cats: meow
|
||||||
|
thing:
|
||||||
|
cats: oranges
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<h3 id="array-splat">Array Splat<a class="headerlink" href="#array-splat" title="Permanent link">¶</a></h3>
|
||||||
|
<p>Given a sample.yaml file of:</p>
|
||||||
|
<pre><code class="yaml">---
|
||||||
|
bob:
|
||||||
|
- cats: bananas
|
||||||
|
- cats: apples
|
||||||
|
- cats: oranges
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>then</p>
|
||||||
|
<pre><code class="bash">yq w sample.yaml bob[*].cats meow
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>will output:</p>
|
||||||
|
<pre><code class="yaml">---
|
||||||
|
bob:
|
||||||
|
- cats: meow
|
||||||
|
- cats: meow
|
||||||
|
- cats: meow
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<h3 id="appending-value-to-an-array-field">Appending value to an array field<a class="headerlink" href="#appending-value-to-an-array-field" title="Permanent link">¶</a></h3>
|
||||||
|
<p>Given a sample.yaml file of:</p>
|
||||||
|
<pre><code class="yaml">b:
|
||||||
|
c: 2
|
||||||
|
d:
|
||||||
|
- new thing
|
||||||
|
- foo thing
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>then</p>
|
||||||
|
<pre><code class="bash">yq w sample.yaml "b.d[+]" "bar thing"
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>will output:</p>
|
||||||
|
<pre><code class="yaml">b:
|
||||||
|
c: cat
|
||||||
|
d:
|
||||||
|
- new thing
|
||||||
|
- foo thing
|
||||||
|
- bar thing
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>Note that the path is in quotes to avoid the square brackets being interpreted by your shell.</p>
|
||||||
|
<h3 id="multiple-documents-update-a-single-document">Multiple Documents - update a single document<a class="headerlink" href="#multiple-documents-update-a-single-document" title="Permanent link">¶</a></h3>
|
||||||
|
<p>Given a sample.yaml file of:</p>
|
||||||
|
<pre><code class="yaml">something: else
|
||||||
|
---
|
||||||
|
b:
|
||||||
|
c: 2
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>then</p>
|
||||||
|
<pre><code class="bash">yq w -d1 sample.yaml b.c 5
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>will output:</p>
|
||||||
|
<pre><code class="yaml">something: else
|
||||||
|
---
|
||||||
|
b:
|
||||||
|
c: 5
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<h3 id="multiple-documents-update-all-documents">Multiple Documents - update all documents<a class="headerlink" href="#multiple-documents-update-all-documents" title="Permanent link">¶</a></h3>
|
||||||
|
<p>Given a sample.yaml file of:</p>
|
||||||
|
<pre><code class="yaml">something: else
|
||||||
|
---
|
||||||
|
b:
|
||||||
|
c: 2
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>then</p>
|
||||||
|
<pre><code class="bash">yq w -d'*' sample.yaml b.c 5
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>will output:</p>
|
||||||
|
<pre><code class="yaml">something: else
|
||||||
|
b:
|
||||||
|
c: 5
|
||||||
|
---
|
||||||
|
b:
|
||||||
|
c: 5
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>Note that '*' is in quotes to avoid being interpreted by your shell.</p>
|
||||||
|
<h3 id="updating-files-in-place">Updating files in-place<a class="headerlink" href="#updating-files-in-place" title="Permanent link">¶</a></h3>
|
||||||
|
<p>Given a sample.yaml file of:</p>
|
||||||
|
<pre><code class="yaml">b:
|
||||||
|
c: 2
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>then</p>
|
||||||
|
<pre><code class="bash">yq w -i sample.yaml b.c cat
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>will update the sample.yaml file so that the value of 'c' is cat.</p>
|
||||||
|
<h3 id="updating-multiple-values-with-a-script">Updating multiple values with a script<a class="headerlink" href="#updating-multiple-values-with-a-script" title="Permanent link">¶</a></h3>
|
||||||
|
<p>Given a sample.yaml file of:</p>
|
||||||
|
<pre><code class="yaml">b:
|
||||||
|
c: 2
|
||||||
|
e:
|
||||||
|
- name: Billy Bob
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>and a script update_instructions.yaml of:</p>
|
||||||
|
<pre><code class="yaml">b.c: 3
|
||||||
|
b.e[+].name: Howdy Partner
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>then</p>
|
||||||
|
<pre><code class="bash">yq w -s update_instructions.yaml sample.yaml
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>will output:</p>
|
||||||
|
<pre><code class="yaml">b:
|
||||||
|
c: 3
|
||||||
|
e:
|
||||||
|
- name: Howdy Partner
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>And, of course, you can pipe the instructions in using '-':</p>
|
||||||
|
<pre><code class="bash">cat update_instructions.yaml | yq w -s - sample.yaml
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<h3 id="values-starting-with-a-hyphen-or-dash">Values starting with a hyphen (or dash)<a class="headerlink" href="#values-starting-with-a-hyphen-or-dash" title="Permanent link">¶</a></h3>
|
||||||
|
<p>The flag terminator needs to be used to stop the app from attempting to parse the subsequent arguments as flags:</p>
|
||||||
|
<pre><code>yq w -- my.path -3
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>will output</p>
|
||||||
|
<pre><code class="yaml">my:
|
||||||
|
path: -3
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<h3 id="keys-with-dots">Keys with dots<a class="headerlink" href="#keys-with-dots" title="Permanent link">¶</a></h3>
|
||||||
|
<p>When specifying a key that has a dot use key lookup indicator.</p>
|
||||||
|
<pre><code class="yaml">b:
|
||||||
|
foo.bar: 7
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<pre><code class="bash">yaml r sample.yaml 'b[foo.bar]'
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<pre><code class="bash">yaml w sample.yaml 'b[foo.bar]' 9
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>Any valid yaml key can be specified as part of a key lookup.</p>
|
||||||
|
<p>Note that the path is in quotes to avoid the square brackets being interpreted by your shell.</p>
|
||||||
|
<h3 id="keys-and-values-with-leading-dashes">Keys (and values) with leading dashes<a class="headerlink" href="#keys-and-values-with-leading-dashes" title="Permanent link">¶</a></h3>
|
||||||
|
<p>If a key or value has leading dashes, yq won't know that you are passing a value as opposed to a flag (and you will get a 'bad flag syntax' error).</p>
|
||||||
|
<p>To fix that, you will need to tell it to stop processing flags by adding '--' after the last flag like so:</p>
|
||||||
|
<pre><code class="bash">yq n -t -- --key --value
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>Will result in</p>
|
||||||
|
<p><code>`
|
||||||
|
--key: --value</code></p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
|
||||||
|
<footer class="md-footer">
|
||||||
|
|
||||||
|
<div class="md-footer-nav">
|
||||||
|
<nav class="md-footer-nav__inner md-grid">
|
||||||
|
|
||||||
|
<a href="../read/" title="Read" class="md-flex md-footer-nav__link md-footer-nav__link--prev" rel="prev">
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<i class="md-icon md-icon--arrow-back md-footer-nav__button"></i>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
|
||||||
|
<span class="md-flex__ellipsis">
|
||||||
|
<span class="md-footer-nav__direction">
|
||||||
|
Previous
|
||||||
|
</span>
|
||||||
|
Read
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
<a href="../prefix/" title="Prefix" class="md-flex md-footer-nav__link md-footer-nav__link--next" rel="next">
|
||||||
|
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
|
||||||
|
<span class="md-flex__ellipsis">
|
||||||
|
<span class="md-footer-nav__direction">
|
||||||
|
Next
|
||||||
|
</span>
|
||||||
|
Prefix
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="md-flex__cell md-flex__cell--shrink">
|
||||||
|
<i class="md-icon md-icon--arrow-forward md-footer-nav__button"></i>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-footer-meta md-typeset">
|
||||||
|
<div class="md-footer-meta__inner md-grid">
|
||||||
|
<div class="md-footer-copyright">
|
||||||
|
|
||||||
|
powered by
|
||||||
|
<a href="https://www.mkdocs.org">MkDocs</a>
|
||||||
|
and
|
||||||
|
<a href="https://squidfunk.github.io/mkdocs-material/">
|
||||||
|
Material for MkDocs</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="md-footer-social">
|
||||||
|
<link rel="stylesheet" href="../assets/fonts/font-awesome.css">
|
||||||
|
|
||||||
|
<a href="https://github.com/mikefarah" class="md-footer-social__link fa fa-github"></a>
|
||||||
|
|
||||||
|
<a href="https://www.linkedin.com/in/mike-farah-b5a75b2/" class="md-footer-social__link fa fa-linkedin"></a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="../assets/javascripts/application.39abc4af.js"></script>
|
||||||
|
|
||||||
|
<script>app.initialize({version:"1.0.4",url:{base:".."}})</script>
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
9
examples/array.yaml
Normal file
9
examples/array.yaml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
- become: true
|
||||||
|
gather_facts: false
|
||||||
|
hosts: lalaland
|
||||||
|
name: "Apply smth"
|
||||||
|
roles:
|
||||||
|
- lala
|
||||||
|
- land
|
||||||
|
serial: 1
|
||||||
2
examples/data1.yaml
Normal file
2
examples/data1.yaml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
a: simple
|
||||||
|
b: [1, 2]
|
||||||
4
examples/data2.yaml
Normal file
4
examples/data2.yaml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
a: other
|
||||||
|
b: [3, 4]
|
||||||
|
c:
|
||||||
|
test: 1
|
||||||
14
examples/data3.yaml
Normal file
14
examples/data3.yaml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
deep1:
|
||||||
|
hostA:
|
||||||
|
value: 1234
|
||||||
|
notRelevant:
|
||||||
|
value: bananas
|
||||||
|
hostB:
|
||||||
|
value: 5678
|
||||||
|
deep2:
|
||||||
|
hostC:
|
||||||
|
value: 1234
|
||||||
|
notRelevant:
|
||||||
|
value: bananas
|
||||||
|
hostD:
|
||||||
|
value: 5678
|
||||||
2
examples/empty.yaml
Normal file
2
examples/empty.yaml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# a: apple
|
||||||
|
# b: cat
|
||||||
2
examples/instruction_sample.yaml
Normal file
2
examples/instruction_sample.yaml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
b.c: cat
|
||||||
|
b.e[+].name: Mike Farah
|
||||||
5
examples/multiline-text.yaml
Normal file
5
examples/multiline-text.yaml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
test: |
|
||||||
|
abcdefg
|
||||||
|
hijklmno
|
||||||
|
|
||||||
|
|
||||||
18
examples/multiple_docs.yaml
Normal file
18
examples/multiple_docs.yaml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
commonKey: first document
|
||||||
|
a: Easy! as one two three
|
||||||
|
b:
|
||||||
|
c: 2
|
||||||
|
d: [3, 4]
|
||||||
|
e:
|
||||||
|
- name: fred
|
||||||
|
value: 3
|
||||||
|
- name: sam
|
||||||
|
value: 4
|
||||||
|
---
|
||||||
|
commonKey: second document
|
||||||
|
another:
|
||||||
|
document: here
|
||||||
|
---
|
||||||
|
commonKey: third document
|
||||||
|
wow:
|
||||||
|
- here is another
|
||||||
7
examples/multiple_docs_small.yaml
Normal file
7
examples/multiple_docs_small.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
a: Easy! as one two three
|
||||||
|
---
|
||||||
|
another:
|
||||||
|
document: here
|
||||||
|
---
|
||||||
|
- 1
|
||||||
|
- 2
|
||||||
2
examples/numbered_keys.yml
Normal file
2
examples/numbered_keys.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
5:
|
||||||
|
6: camel!
|
||||||
2
examples/order.yaml
Normal file
2
examples/order.yaml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
version: 3
|
||||||
|
application: MyApp
|
||||||
6
examples/order.yml
Normal file
6
examples/order.yml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
version: '2'
|
||||||
|
services:
|
||||||
|
test:
|
||||||
|
image: ubuntu:14.04
|
||||||
|
stdin_open: true
|
||||||
|
tty: true
|
||||||
1
examples/sample.json
Normal file
1
examples/sample.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"a":"Easy! as one two three","b":{"c":2,"d":[3,4],"e":[{"name":"fred","value":3},{"name":"sam","value":4}]}}
|
||||||
@@ -6,4 +6,4 @@ b:
|
|||||||
- name: fred
|
- name: fred
|
||||||
value: 3
|
value: 3
|
||||||
- name: sam
|
- name: sam
|
||||||
value: 4
|
value: 4
|
||||||
9
examples/sample2.yaml
Normal file
9
examples/sample2.yaml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
a: Easy! as one two three
|
||||||
|
b:
|
||||||
|
c: things
|
||||||
|
d: whatever
|
||||||
|
things:
|
||||||
|
thing1:
|
||||||
|
cat: 'fred'
|
||||||
|
thing2:
|
||||||
|
cat: 'sam'
|
||||||
1
examples/sample_array.yaml
Normal file
1
examples/sample_array.yaml
Normal file
@@ -0,0 +1 @@
|
|||||||
|
[1,2,3]
|
||||||
1
examples/sample_array_2.yaml
Normal file
1
examples/sample_array_2.yaml
Normal file
@@ -0,0 +1 @@
|
|||||||
|
[4,5]
|
||||||
1
examples/sample_text.yaml
Normal file
1
examples/sample_text.yaml
Normal file
@@ -0,0 +1 @@
|
|||||||
|
hi
|
||||||
12
go.mod
Normal file
12
go.mod
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
module github.com/mikefarah/yq/v2
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/mikefarah/yaml/v2 v2.4.0
|
||||||
|
github.com/pkg/errors v0.8.1
|
||||||
|
github.com/spf13/cobra v0.0.5
|
||||||
|
golang.org/x/tools v0.0.0-20191030203535-5e247c9ad0a0 // indirect
|
||||||
|
gopkg.in/imdario/mergo.v0 v0.3.7
|
||||||
|
gopkg.in/op/go-logging.v1 v1.0.0-20160211212156-b2cb9fa56473
|
||||||
|
)
|
||||||
|
|
||||||
|
go 1.13
|
||||||
50
go.sum
Normal file
50
go.sum
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
|
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
|
||||||
|
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
|
||||||
|
github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk=
|
||||||
|
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
|
||||||
|
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
|
||||||
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||||
|
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
||||||
|
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
|
||||||
|
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
||||||
|
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
|
||||||
|
github.com/mikefarah/yaml/v2 v2.4.0 h1:eYqfooY0BnvKTJxr7+ABJs13n3dg9n347GScDaU2Lww=
|
||||||
|
github.com/mikefarah/yaml/v2 v2.4.0/go.mod h1:ahVqZF4n1W4NqwvVnZzC4es67xsW9uR/RRf2RRxieJU=
|
||||||
|
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
||||||
|
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||||
|
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
|
||||||
|
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
|
||||||
|
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
|
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
|
||||||
|
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
|
||||||
|
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
||||||
|
github.com/spf13/cobra v0.0.5 h1:f0B+LkLX6DtmRH1isoNA9VTtNUK9K8xYd28JNNfOv/s=
|
||||||
|
github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU=
|
||||||
|
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
|
||||||
|
github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg=
|
||||||
|
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||||
|
github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s=
|
||||||
|
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
|
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
|
||||||
|
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
|
||||||
|
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||||
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
|
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
|
golang.org/x/tools v0.0.0-20191030203535-5e247c9ad0a0 h1:s5lp4ug7qHzUccgyFdjsX7OZDzHXRaePrF3B3vmUiuM=
|
||||||
|
golang.org/x/tools v0.0.0-20191030203535-5e247c9ad0a0/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
|
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||||
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/imdario/mergo.v0 v0.3.7 h1:QDotlIZtaO/p+Um0ok18HRTpq5i5/SAk/qprsor+9c8=
|
||||||
|
gopkg.in/imdario/mergo.v0 v0.3.7/go.mod h1:9qPP6AGrlC1G2PTNXko614FwGZvorN7MiBU0Eppok+U=
|
||||||
|
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/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
|
||||||
|
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
44
json_converter.go
Normal file
44
json_converter.go
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
yaml "github.com/mikefarah/yaml/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
func jsonToString(context interface{}) (string, error) {
|
||||||
|
out, err := json.Marshal(toJSON(context))
|
||||||
|
if err != nil {
|
||||||
|
return "", fmt.Errorf("error printing yaml as json: %v", err)
|
||||||
|
}
|
||||||
|
return string(out), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func toJSON(context interface{}) interface{} {
|
||||||
|
switch context := context.(type) {
|
||||||
|
case []interface{}:
|
||||||
|
oldArray := context
|
||||||
|
newArray := make([]interface{}, len(oldArray))
|
||||||
|
for index, value := range oldArray {
|
||||||
|
newArray[index] = toJSON(value)
|
||||||
|
}
|
||||||
|
return newArray
|
||||||
|
case yaml.MapSlice:
|
||||||
|
oldMap := context
|
||||||
|
newMap := make(map[string]interface{})
|
||||||
|
for _, entry := range oldMap {
|
||||||
|
if str, ok := entry.Key.(string); ok {
|
||||||
|
newMap[str] = toJSON(entry.Value)
|
||||||
|
} else if i, ok := entry.Key.(int); ok {
|
||||||
|
newMap[strconv.Itoa(i)] = toJSON(entry.Value)
|
||||||
|
} else if b, ok := entry.Key.(bool); ok {
|
||||||
|
newMap[strconv.FormatBool(b)] = toJSON(entry.Value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return newMap
|
||||||
|
default:
|
||||||
|
return context
|
||||||
|
}
|
||||||
|
}
|
||||||
46
json_converter_test.go
Normal file
46
json_converter_test.go
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestJsonToString(t *testing.T) {
|
||||||
|
var data = parseData(`
|
||||||
|
---
|
||||||
|
b:
|
||||||
|
c: 2
|
||||||
|
`)
|
||||||
|
got, _ := jsonToString(data)
|
||||||
|
assertResult(t, "{\"b\":{\"c\":2}}", got)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestJsonToString_withIntKey(t *testing.T) {
|
||||||
|
var data = parseData(`
|
||||||
|
---
|
||||||
|
b:
|
||||||
|
2: c
|
||||||
|
`)
|
||||||
|
got, _ := jsonToString(data)
|
||||||
|
assertResult(t, `{"b":{"2":"c"}}`, got)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestJsonToString_withBoolKey(t *testing.T) {
|
||||||
|
var data = parseData(`
|
||||||
|
---
|
||||||
|
b:
|
||||||
|
false: c
|
||||||
|
`)
|
||||||
|
got, _ := jsonToString(data)
|
||||||
|
assertResult(t, `{"b":{"false":"c"}}`, got)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestJsonToString_withArray(t *testing.T) {
|
||||||
|
var data = parseData(`
|
||||||
|
---
|
||||||
|
b:
|
||||||
|
- item: one
|
||||||
|
- item: two
|
||||||
|
`)
|
||||||
|
got, _ := jsonToString(data)
|
||||||
|
assertResult(t, "{\"b\":[{\"item\":\"one\"},{\"item\":\"two\"}]}", got)
|
||||||
|
}
|
||||||
12
merge.go
Normal file
12
merge.go
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import mergo "gopkg.in/imdario/mergo.v0"
|
||||||
|
|
||||||
|
func merge(dst interface{}, src interface{}, overwrite bool, append bool) error {
|
||||||
|
if overwrite {
|
||||||
|
return mergo.Merge(dst, src, mergo.WithOverride)
|
||||||
|
} else if append {
|
||||||
|
return mergo.Merge(dst, src, mergo.WithAppendSlice)
|
||||||
|
}
|
||||||
|
return mergo.Merge(dst, src)
|
||||||
|
}
|
||||||
28
mkdocs.yml
Normal file
28
mkdocs.yml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
docs_dir: mkdocs
|
||||||
|
site_dir: docs
|
||||||
|
site_name: Yq
|
||||||
|
theme: 'material'
|
||||||
|
pages:
|
||||||
|
- Install: index.md
|
||||||
|
- Read: read.md
|
||||||
|
- Write/Update: write.md
|
||||||
|
- Prefix: prefix.md
|
||||||
|
- Delete: delete.md
|
||||||
|
- Create: create.md
|
||||||
|
- Convert: convert.md
|
||||||
|
- Merge: merge.md
|
||||||
|
repo_name: 'mikefarah/yq'
|
||||||
|
repo_url: 'https://github.com/mikefarah/yq'
|
||||||
|
|
||||||
|
extra:
|
||||||
|
social:
|
||||||
|
- type: 'github'
|
||||||
|
link: 'https://github.com/mikefarah'
|
||||||
|
- type: 'linkedin'
|
||||||
|
link: 'https://www.linkedin.com/in/mike-farah-b5a75b2/'
|
||||||
|
|
||||||
|
markdown_extensions:
|
||||||
|
- markdown_include.include:
|
||||||
|
base_path: mkdocs
|
||||||
|
- toc:
|
||||||
|
permalink: True
|
||||||
40
mkdocs/convert.md
Normal file
40
mkdocs/convert.md
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
### Yaml to Json
|
||||||
|
To convert output to json, use the --tojson (or -j) flag. This can only be used with the read command.
|
||||||
|
|
||||||
|
Given a sample.yaml file of:
|
||||||
|
```yaml
|
||||||
|
b:
|
||||||
|
c: 2
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq r -j sample.yaml b.c
|
||||||
|
```
|
||||||
|
|
||||||
|
will output
|
||||||
|
```json
|
||||||
|
{"b":{"c":2}}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Json to Yaml
|
||||||
|
To read in json, just pass in a json file instead of yaml, it will just work :)
|
||||||
|
|
||||||
|
e.g given a json file
|
||||||
|
|
||||||
|
```json
|
||||||
|
{"a":"Easy! as one two three","b":{"c":2,"d":[3,4]}}
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq r sample.json
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
a: Easy! as one two three
|
||||||
|
b:
|
||||||
|
c: 2
|
||||||
|
d:
|
||||||
|
- 3
|
||||||
|
- 4
|
||||||
|
```
|
||||||
|
|
||||||
44
mkdocs/create.md
Normal file
44
mkdocs/create.md
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
Yaml files can be created using the 'new' command. This works in the same way as the write command, but you don't pass in an existing Yaml file. Currently this does not support creating multiple documents in a single yaml file.
|
||||||
|
|
||||||
|
```
|
||||||
|
yq n <path> <new value>
|
||||||
|
```
|
||||||
|
|
||||||
|
### Creating a simple yaml file
|
||||||
|
```bash
|
||||||
|
yq n b.c cat
|
||||||
|
```
|
||||||
|
will output:
|
||||||
|
```yaml
|
||||||
|
b:
|
||||||
|
c: cat
|
||||||
|
```
|
||||||
|
|
||||||
|
### Creating using a create script
|
||||||
|
Create scripts follow the same format as the update scripts.
|
||||||
|
|
||||||
|
Given a script create_instructions.yaml of:
|
||||||
|
```yaml
|
||||||
|
b.c: 3
|
||||||
|
b.e[+].name: Howdy Partner
|
||||||
|
```
|
||||||
|
then
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yq n -s create_instructions.yaml
|
||||||
|
```
|
||||||
|
will output:
|
||||||
|
```yaml
|
||||||
|
b:
|
||||||
|
c: 3
|
||||||
|
e:
|
||||||
|
- name: Howdy Partner
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also pipe the instructions in:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cat create_instructions.yaml | yq n -s -
|
||||||
|
```
|
||||||
|
|
||||||
|
{!snippets/niche.md!}
|
||||||
197
mkdocs/delete.md
Normal file
197
mkdocs/delete.md
Normal file
@@ -0,0 +1,197 @@
|
|||||||
|
```
|
||||||
|
yq d <yaml_file> <path_to_delete>
|
||||||
|
```
|
||||||
|
|
||||||
|
### To Stdout
|
||||||
|
Given a sample.yaml file of:
|
||||||
|
```yaml
|
||||||
|
b:
|
||||||
|
c: 2
|
||||||
|
apples: green
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq d sample.yaml b.c
|
||||||
|
```
|
||||||
|
will output:
|
||||||
|
```yaml
|
||||||
|
b:
|
||||||
|
apples: green
|
||||||
|
```
|
||||||
|
|
||||||
|
### From STDIN
|
||||||
|
```bash
|
||||||
|
cat sample.yaml | yq d - b.c
|
||||||
|
```
|
||||||
|
|
||||||
|
### Deleting array elements
|
||||||
|
Given a sample.yaml file of:
|
||||||
|
```yaml
|
||||||
|
b:
|
||||||
|
c:
|
||||||
|
- 1
|
||||||
|
- 2
|
||||||
|
- 3
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq d sample.yaml 'b.c[1]'
|
||||||
|
```
|
||||||
|
will output:
|
||||||
|
```yaml
|
||||||
|
b:
|
||||||
|
c:
|
||||||
|
- 1
|
||||||
|
- 3
|
||||||
|
```
|
||||||
|
|
||||||
|
### Deleting nodes in-place
|
||||||
|
Given a sample.yaml file of:
|
||||||
|
```yaml
|
||||||
|
b:
|
||||||
|
c: 2
|
||||||
|
apples: green
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq d -i sample.yaml b.c
|
||||||
|
```
|
||||||
|
will update the sample.yaml file so that the 'c' node is deleted
|
||||||
|
|
||||||
|
|
||||||
|
### Splat
|
||||||
|
Given a sample.yaml file of:
|
||||||
|
```yaml
|
||||||
|
---
|
||||||
|
bob:
|
||||||
|
item1:
|
||||||
|
cats: bananas
|
||||||
|
dogs: woof
|
||||||
|
item2:
|
||||||
|
cats: apples
|
||||||
|
dogs: woof2
|
||||||
|
thing:
|
||||||
|
cats: oranges
|
||||||
|
dogs: woof3
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq d sample.yaml bob.*.cats
|
||||||
|
```
|
||||||
|
will output:
|
||||||
|
```yaml
|
||||||
|
---
|
||||||
|
bob:
|
||||||
|
item1:
|
||||||
|
dogs: woof
|
||||||
|
item2:
|
||||||
|
dogs: woof2
|
||||||
|
thing:
|
||||||
|
dogs: woof3
|
||||||
|
```
|
||||||
|
|
||||||
|
### Prefix Splat
|
||||||
|
Given a sample.yaml file of:
|
||||||
|
```yaml
|
||||||
|
---
|
||||||
|
bob:
|
||||||
|
item1:
|
||||||
|
cats: bananas
|
||||||
|
dogs: woof
|
||||||
|
item2:
|
||||||
|
cats: apples
|
||||||
|
dogs: woof2
|
||||||
|
thing:
|
||||||
|
cats: oranges
|
||||||
|
dogs: woof3
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq d sample.yaml bob.item*.cats
|
||||||
|
```
|
||||||
|
will output:
|
||||||
|
```yaml
|
||||||
|
---
|
||||||
|
bob:
|
||||||
|
item1:
|
||||||
|
dogs: woof
|
||||||
|
item2:
|
||||||
|
dogs: woof2
|
||||||
|
thing:
|
||||||
|
cats: oranges
|
||||||
|
dogs: woof3
|
||||||
|
```
|
||||||
|
|
||||||
|
### Array Splat
|
||||||
|
Given a sample.yaml file of:
|
||||||
|
```yaml
|
||||||
|
---
|
||||||
|
bob:
|
||||||
|
- cats: bananas
|
||||||
|
dogs: woof
|
||||||
|
- cats: apples
|
||||||
|
dogs: woof2
|
||||||
|
- cats: oranges
|
||||||
|
dogs: woof3
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq d sample.yaml bob.[*].cats
|
||||||
|
```
|
||||||
|
will output:
|
||||||
|
```yaml
|
||||||
|
---
|
||||||
|
bob:
|
||||||
|
- dogs: woof
|
||||||
|
- dogs: woof2
|
||||||
|
- dogs: woof3
|
||||||
|
```
|
||||||
|
|
||||||
|
### Multiple Documents - delete from single document
|
||||||
|
Given a sample.yaml file of:
|
||||||
|
```yaml
|
||||||
|
something: else
|
||||||
|
field: leaveMe
|
||||||
|
---
|
||||||
|
b:
|
||||||
|
c: 2
|
||||||
|
field: deleteMe
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq w -d1 sample.yaml field
|
||||||
|
```
|
||||||
|
will output:
|
||||||
|
```yaml
|
||||||
|
something: else
|
||||||
|
field: leaveMe
|
||||||
|
---
|
||||||
|
b:
|
||||||
|
c: 2
|
||||||
|
```
|
||||||
|
|
||||||
|
### Multiple Documents - delete from all documents
|
||||||
|
Given a sample.yaml file of:
|
||||||
|
```yaml
|
||||||
|
something: else
|
||||||
|
field: deleteMe
|
||||||
|
---
|
||||||
|
b:
|
||||||
|
c: 2
|
||||||
|
field: deleteMeToo
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq w -d'*' sample.yaml field
|
||||||
|
```
|
||||||
|
will output:
|
||||||
|
```yaml
|
||||||
|
something: else
|
||||||
|
---
|
||||||
|
b:
|
||||||
|
c: 2
|
||||||
|
```
|
||||||
|
|
||||||
|
Note that '*' is in quotes to avoid being interpreted by your shell.
|
||||||
|
|
||||||
|
{!snippets/niche.md!}
|
||||||
26
mkdocs/index.md
Normal file
26
mkdocs/index.md
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
# yq
|
||||||
|
yq is a lightweight and portable command-line YAML processor
|
||||||
|
|
||||||
|
The aim of the project is to be the [jq](https://github.com/stedolan/jq) or sed of yaml files.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
On MacOS:
|
||||||
|
```
|
||||||
|
brew install yq
|
||||||
|
```
|
||||||
|
On Ubuntu and other Linux distros supporting `snap` packages:
|
||||||
|
```
|
||||||
|
snap install yq
|
||||||
|
```
|
||||||
|
On Ubuntu 16.04 or higher from Debian package:
|
||||||
|
```
|
||||||
|
sudo add-apt-repository ppa:rmescandon/yq
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install yq -y
|
||||||
|
```
|
||||||
|
or, [Download latest binary](https://github.com/mikefarah/yq/releases/latest) or alternatively:
|
||||||
|
```
|
||||||
|
go get gopkg.in/mikefarah/yq.v2
|
||||||
|
```
|
||||||
|
|
||||||
|
[View on GitHub](https://github.com/mikefarah/yq)
|
||||||
189
mkdocs/merge.md
Normal file
189
mkdocs/merge.md
Normal file
@@ -0,0 +1,189 @@
|
|||||||
|
Yaml files can be merged using the 'merge' command. Each additional file merged with the first file will
|
||||||
|
set values for any key not existing already or where the key has no value.
|
||||||
|
|
||||||
|
```
|
||||||
|
yq m <yaml_file> <path>...
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### To Stdout
|
||||||
|
Given a data1.yaml file of:
|
||||||
|
```yaml
|
||||||
|
a: simple
|
||||||
|
b: [1, 2]
|
||||||
|
```
|
||||||
|
and data2.yaml file of:
|
||||||
|
```yaml
|
||||||
|
a: other
|
||||||
|
c:
|
||||||
|
test: 1
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq m data1.yaml data2.yaml
|
||||||
|
```
|
||||||
|
will output:
|
||||||
|
```yaml
|
||||||
|
a: simple
|
||||||
|
b: [1, 2]
|
||||||
|
c:
|
||||||
|
test: 1
|
||||||
|
```
|
||||||
|
|
||||||
|
### Updating files in-place
|
||||||
|
Given a data1.yaml file of:
|
||||||
|
```yaml
|
||||||
|
a: simple
|
||||||
|
b: [1, 2]
|
||||||
|
```
|
||||||
|
and data2.yaml file of:
|
||||||
|
```yaml
|
||||||
|
a: other
|
||||||
|
c:
|
||||||
|
test: 1
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq m -i data1.yaml data2.yaml
|
||||||
|
```
|
||||||
|
will update the data1.yaml file so that the value of 'c' is 'test: 1'.
|
||||||
|
|
||||||
|
### Overwrite values
|
||||||
|
Given a data1.yaml file of:
|
||||||
|
```yaml
|
||||||
|
a: simple
|
||||||
|
b: [1, 2]
|
||||||
|
```
|
||||||
|
and data2.yaml file of:
|
||||||
|
```yaml
|
||||||
|
a: other
|
||||||
|
c:
|
||||||
|
test: 1
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq m -x data1.yaml data2.yaml
|
||||||
|
```
|
||||||
|
will output:
|
||||||
|
```yaml
|
||||||
|
a: other
|
||||||
|
b: [1, 2]
|
||||||
|
c:
|
||||||
|
test: 1
|
||||||
|
```
|
||||||
|
|
||||||
|
### Overwrite values with arrays
|
||||||
|
Given a data1.yaml file of:
|
||||||
|
```yaml
|
||||||
|
a: simple
|
||||||
|
b: [1, 2]
|
||||||
|
```
|
||||||
|
and data3.yaml file of:
|
||||||
|
```yaml
|
||||||
|
b: [3, 4]
|
||||||
|
c:
|
||||||
|
test: 2
|
||||||
|
other: true
|
||||||
|
d: false
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq m -x data1.yaml data3.yaml
|
||||||
|
```
|
||||||
|
will output:
|
||||||
|
```yaml
|
||||||
|
a: simple
|
||||||
|
b: [3, 4]
|
||||||
|
c:
|
||||||
|
test: 2
|
||||||
|
other: true
|
||||||
|
d: false
|
||||||
|
```
|
||||||
|
|
||||||
|
Notice that 'b' does not result in the merging of the values within an array.
|
||||||
|
|
||||||
|
### Append values with arrays
|
||||||
|
Given a data1.yaml file of:
|
||||||
|
```yaml
|
||||||
|
a: simple
|
||||||
|
b: [1, 2]
|
||||||
|
d: hi
|
||||||
|
```
|
||||||
|
and data3.yaml file of:
|
||||||
|
```yaml
|
||||||
|
a: something
|
||||||
|
b: [3, 4]
|
||||||
|
c:
|
||||||
|
test: 2
|
||||||
|
other: true
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq m -a data1.yaml data3.yaml
|
||||||
|
```
|
||||||
|
will output:
|
||||||
|
```yaml
|
||||||
|
a: simple
|
||||||
|
b: [1, 2, 3, 4]
|
||||||
|
c:
|
||||||
|
test: 2
|
||||||
|
other: true
|
||||||
|
d: hi
|
||||||
|
```
|
||||||
|
|
||||||
|
Note that the 'b' array has concatenated the values from the second data file. Also note that other map keys are not overridden (field a).
|
||||||
|
|
||||||
|
Append cannot be used with overwrite, if both flags are given then append is ignored.
|
||||||
|
|
||||||
|
### Multiple Documents - merge into single document
|
||||||
|
Currently yq only has multi-document support for the _first_ document being merged into. The remaining yaml files will have their first document selected.
|
||||||
|
|
||||||
|
Given a data1.yaml file of:
|
||||||
|
```yaml
|
||||||
|
something: else
|
||||||
|
---
|
||||||
|
a: simple
|
||||||
|
b: cat
|
||||||
|
```
|
||||||
|
and data3.yaml file of:
|
||||||
|
```yaml
|
||||||
|
b: dog
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq m -x -d1 data1.yaml data3.yaml
|
||||||
|
```
|
||||||
|
will output:
|
||||||
|
```yaml
|
||||||
|
something: else
|
||||||
|
---
|
||||||
|
a: simple
|
||||||
|
b: dog
|
||||||
|
```
|
||||||
|
|
||||||
|
### Multiple Documents - merge into all documents
|
||||||
|
Currently yq only has multi-document support for the _first_ document being merged into. The remaining yaml files will have their first document selected.
|
||||||
|
|
||||||
|
Given a data1.yaml file of:
|
||||||
|
```yaml
|
||||||
|
something: else
|
||||||
|
---
|
||||||
|
a: simple
|
||||||
|
b: cat
|
||||||
|
```
|
||||||
|
and data3.yaml file of:
|
||||||
|
```yaml
|
||||||
|
b: dog
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq m -x -d'*' data1.yaml data3.yaml
|
||||||
|
```
|
||||||
|
will output:
|
||||||
|
```yaml
|
||||||
|
b: dog
|
||||||
|
something: else
|
||||||
|
---
|
||||||
|
a: simple
|
||||||
|
b: dog
|
||||||
|
```
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user