mirror of
https://github.com/taigrr/yq
synced 2025-01-18 04:53:17 -08:00
Updated docs to explicity put array paths in quotes
This commit is contained in:
@@ -494,7 +494,7 @@
|
||||
</code></pre>
|
||||
|
||||
<p>then</p>
|
||||
<pre><code class="bash">yq w sample.yaml b.d[+] "bar thing"
|
||||
<pre><code class="bash">yq w sample.yaml "b.d[+]" "bar thing"
|
||||
</code></pre>
|
||||
|
||||
<p>will output:</p>
|
||||
@@ -506,6 +506,7 @@
|
||||
- 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="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:
|
||||
@@ -561,13 +562,14 @@ b.e[0].name: Howdy Partner
|
||||
foo.bar: 7
|
||||
</code></pre>
|
||||
|
||||
<pre><code class="bash">yaml r sample.yaml b[foo.bar]
|
||||
<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
|
||||
<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>
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user