1
0
mirror of https://github.com/taigrr/yq synced 2025-01-18 04:53:17 -08:00

Updated docs to include value parsing

This commit is contained in:
Mike Farah
2020-01-20 08:35:03 +11:00
parent b7148adf20
commit 8a65822b0b
16 changed files with 1502 additions and 555 deletions

View File

@@ -94,7 +94,7 @@
<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="#from-stdin" tabindex="1" class="md-skip">
<a href="#deleting-from-a-simple-document" tabindex="1" class="md-skip">
Skip to content
</a>
@@ -241,8 +241,8 @@
<li class="md-nav__item">
<a href="../read/" title="Read" class="md-nav__link">
Read
<a href="../path_expressions/" title="Path Expressions" class="md-nav__link">
Path Expressions
</a>
</li>
@@ -253,8 +253,20 @@
<li class="md-nav__item">
<a href="../path_expressions/" title="Path Expressions" class="md-nav__link">
Path Expressions
<a href="../value_parsing/" title="Value Parsing" class="md-nav__link">
Value Parsing
</a>
</li>
<li class="md-nav__item">
<a href="../read/" title="Read" class="md-nav__link">
Read
</a>
</li>
@@ -311,6 +323,13 @@
<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="#deleting-from-a-simple-document" title="Deleting from a simple document" class="md-nav__link">
Deleting from a simple document
</a>
</li>
<li class="md-nav__item">
<a href="#from-stdin" title="From STDIN" class="md-nav__link">
From STDIN
@@ -319,25 +338,38 @@
</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 href="#deleting-in-place" title="Deleting in-place" class="md-nav__link">
Deleting in-place
</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 href="#multiple-documents" title="Multiple Documents" class="md-nav__link">
Multiple Documents
</a>
<nav class="md-nav">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#delete-from-single-document" title="Delete from single document" class="md-nav__link">
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
<li class="md-nav__item">
<a href="#delete-from-all-documents" title="Delete from all documents" class="md-nav__link">
Delete from all documents
</a>
</li>
</ul>
</nav>
</li>
@@ -404,6 +436,13 @@
<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="#deleting-from-a-simple-document" title="Deleting from a simple document" class="md-nav__link">
Deleting from a simple document
</a>
</li>
<li class="md-nav__item">
<a href="#from-stdin" title="From STDIN" class="md-nav__link">
From STDIN
@@ -412,25 +451,38 @@
</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 href="#deleting-in-place" title="Deleting in-place" class="md-nav__link">
Deleting in-place
</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 href="#multiple-documents" title="Multiple Documents" class="md-nav__link">
Multiple Documents
</a>
<nav class="md-nav">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#delete-from-single-document" title="Delete from single document" class="md-nav__link">
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
<li class="md-nav__item">
<a href="#delete-from-all-documents" title="Delete from all documents" class="md-nav__link">
Delete from all documents
</a>
</li>
</ul>
</nav>
</li>
@@ -458,12 +510,7 @@
<p>The delete command will delete all the matching nodes for the path expression in the given yaml input.</p>
<p>See docs for <a href="../path_expressions/">path expression</a> for more details.</p>
<h3 id="from-stdin">From STDIN<a class="headerlink" href="#from-stdin" title="Permanent link">&para;</a></h3>
<p>Use "-" (without quotes) inplace of a file name if you wish to pipe in input from STDIN.</p>
<pre><code class="bash">cat sample.yaml | yq d - b.c
</code></pre>
<h3 id="deleting-nodes-in-place">Deleting nodes in-place<a class="headerlink" href="#deleting-nodes-in-place" title="Permanent link">&para;</a></h3>
<h2 id="deleting-from-a-simple-document">Deleting from a simple document<a class="headerlink" href="#deleting-from-a-simple-document" title="Permanent link">&para;</a></h2>
<p>Given a sample.yaml file of:</p>
<pre><code class="yaml">b:
c: 2
@@ -471,11 +518,26 @@
</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>
<h2 id="from-stdin">From STDIN<a class="headerlink" href="#from-stdin" title="Permanent link">&para;</a></h2>
<p>Use "-" (without quotes) in-place of a file name if you wish to pipe in input from STDIN.</p>
<pre><code class="bash">cat sample.yaml | yq d - b.c
</code></pre>
<h2 id="deleting-in-place">Deleting in-place<a class="headerlink" href="#deleting-in-place" title="Permanent link">&para;</a></h2>
<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="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">&para;</a></h3>
<h2 id="multiple-documents">Multiple Documents<a class="headerlink" href="#multiple-documents" title="Permanent link">&para;</a></h2>
<h3 id="delete-from-single-document">Delete from single document<a class="headerlink" href="#delete-from-single-document" title="Permanent link">&para;</a></h3>
<p>Given a sample.yaml file of:</p>
<pre><code class="yaml">something: else
field: leaveMe
@@ -497,7 +559,7 @@ 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">&para;</a></h3>
<h3 id="delete-from-all-documents">Delete from all documents<a class="headerlink" href="#delete-from-all-documents" title="Permanent link">&para;</a></h3>
<p>Given a sample.yaml file of:</p>
<pre><code class="yaml">something: else
field: deleteMe
@@ -517,8 +579,6 @@ field: deleteMeToo
b:
c: 2
</code></pre>
<p>Note that '*' is in quotes to avoid being interpreted by your shell.</p>