From 3fe9e55f36d1aed3888e0f835394ae45acafb00f Mon Sep 17 00:00:00 2001 From: Mike Farah Date: Fri, 15 Apr 2022 08:52:46 +1000 Subject: [PATCH] v4.24.5 --- operators/add.md | 4 +++- operators/assign-update.md | 7 +++++-- usage/front-matter.md | 6 ++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/operators/add.md b/operators/add.md index 52452ef4..e6c3e099 100644 --- a/operators/add.md +++ b/operators/add.md @@ -135,7 +135,9 @@ a: b: - dog - mouse - a3: {b: [mouse]} + a3: + b: + - mouse ``` ## String concatenation diff --git a/operators/assign-update.md b/operators/assign-update.md index d3a9a6b8..ff6b0860 100644 --- a/operators/assign-update.md +++ b/operators/assign-update.md @@ -199,7 +199,8 @@ yq '.a.b |= "bogs"' sample.yml ``` will output ```yaml -{a: {b: bogs}} +a: + b: bogs ``` ## Update node value that has an anchor @@ -229,6 +230,8 @@ yq '.a.b.[0] |= "bogs"' sample.yml ``` will output ```yaml -{a: {b: [bogs]}} +a: + b: + - bogs ``` diff --git a/usage/front-matter.md b/usage/front-matter.md index 598159d2..7083e898 100644 --- a/usage/front-matter.md +++ b/usage/front-matter.md @@ -2,6 +2,12 @@ `yq` can process files with `yaml` front matter (e.g. jekyll, assemble and others) - this is done via the `--front-matter/-f` flag. +Note that `yq` only processes the first passed in file for front-matter. If you'd like to process multiple files, you can: + +```bash +find -name "*.md" -exec yq --front-matter="process" '.updated_at = now' {} \; +``` + ## Process front matter Use `--front-matter=process` to process the front matter, that is run the expression against the `yaml` content, and output back the entire file, included the non-yaml content block. For example: