Added notification banner to docs

This commit is contained in:
Mike Farah 2022-02-06 14:39:46 +11:00
parent de38abb121
commit 1f367ac200
48 changed files with 292 additions and 4 deletions

View File

@ -0,0 +1,6 @@
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified. 
`yq e <exp> <file>`
{% endhint %}

View File

@ -9,6 +9,12 @@ Add behaves differently according to the type of the LHS:
Use `+=` as a relative append assign for things like increment. Note that `.a += .x` is equivalent to running `.a = .a + .x`. Use `+=` as a relative append assign for things like increment. Note that `.a += .x` is equivalent to running `.a = .a + .x`.
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#x20;
`yq e <exp> <file>`
{% endhint %}
## Concatenate arrays ## Concatenate arrays
Given a sample.yml file of: Given a sample.yml file of:
```yaml ```yaml

View File

@ -2,6 +2,12 @@
This operator is used to provide alternative (or default) values when a particular expression is either null or false. This operator is used to provide alternative (or default) values when a particular expression is either null or false.
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#x20;
`yq e <exp> <file>`
{% endhint %}
## LHS is defined ## LHS is defined
Given a sample.yml file of: Given a sample.yml file of:
```yaml ```yaml

View File

@ -5,6 +5,12 @@ Use the `alias` and `anchor` operators to read and write yaml aliases and anchor
`yq` supports merge aliases (like `<<: *blah`) however this is no longer in the standard yaml spec (1.2) and so `yq` will automatically add the `!!merge` tag to these nodes as it is effectively a custom tag. `yq` supports merge aliases (like `<<: *blah`) however this is no longer in the standard yaml spec (1.2) and so `yq` will automatically add the `!!merge` tag to these nodes as it is effectively a custom tag.
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#x20;
`yq e <exp> <file>`
{% endhint %}
## Merge one map ## Merge one map
see https://yaml.org/type/merge.html see https://yaml.org/type/merge.html

View File

@ -7,6 +7,12 @@ Which will assign the LHS node values to the RHS node values. The RHS expression
### relative form: `|=` ### relative form: `|=`
This will do a similar thing to the plain form, however, the RHS expression is run against _the LHS nodes_. This is useful for updating values based on old values, e.g. increment. This will do a similar thing to the plain form, however, the RHS expression is run against _the LHS nodes_. This is useful for updating values based on old values, e.g. increment.
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#x20;
`yq e <exp> <file>`
{% endhint %}
## Create yaml file ## Create yaml file
Running Running
```bash ```bash

View File

@ -10,6 +10,12 @@ The `or` and `and` operators take two parameters and return a boolean result.
These are most commonly used with the `select` operator to filter particular nodes. These are most commonly used with the `select` operator to filter particular nodes.
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#x20;
`yq e <exp> <file>`
{% endhint %}
## `or` example ## `or` example
Running Running
```bash ```bash

View File

@ -3,6 +3,12 @@
This creates an array using the expression between the square brackets. This creates an array using the expression between the square brackets.
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#x20;
`yq e <exp> <file>`
{% endhint %}
## Collect empty ## Collect empty
Running Running
```bash ```bash

View File

@ -10,6 +10,12 @@ This will assign the LHS nodes comments to the expression on the RHS. The RHS is
### relative form: `|=` ### relative form: `|=`
Similar to the plain form, however the RHS evaluates against each matching LHS node! This is useful if you want to set the comments as a relative expression of the node, for instance its value or path. Similar to the plain form, however the RHS evaluates against each matching LHS node! This is useful if you want to set the comments as a relative expression of the node, for instance its value or path.
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#x20;
`yq e <exp> <file>`
{% endhint %}
## Set line comment ## Set line comment
Given a sample.yml file of: Given a sample.yml file of:
```yaml ```yaml

View File

@ -2,6 +2,12 @@
This returns `true` if the context contains the passed in parameter, and false otherwise. This returns `true` if the context contains the passed in parameter, and false otherwise.
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#x20;
`yq e <exp> <file>`
{% endhint %}
## Array contains array ## Array contains array
Array is equal or subset of Array is equal or subset of

View File

@ -2,6 +2,12 @@
This is used to construct objects (or maps). This can be used against existing yaml, or to create fresh yaml documents. This is used to construct objects (or maps). This can be used against existing yaml, or to create fresh yaml documents.
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#x20;
`yq e <exp> <file>`
{% endhint %}
## Collect empty object ## Collect empty object
Running Running
```bash ```bash

View File

@ -2,6 +2,12 @@
Deletes matching entries in maps or arrays. Deletes matching entries in maps or arrays.
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#x20;
`yq e <exp> <file>`
{% endhint %}
## Delete entry in map ## Delete entry in map
Given a sample.yml file of: Given a sample.yml file of:
```yaml ```yaml

View File

@ -2,6 +2,12 @@
Use the `documentIndex` operator (or the `di` shorthand) to select nodes of a particular document. Use the `documentIndex` operator (or the `di` shorthand) to select nodes of a particular document.
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#x20;
`yq e <exp> <file>`
{% endhint %}
## Retrieve a document index ## Retrieve a document index
Given a sample.yml file of: Given a sample.yml file of:
```yaml ```yaml

View File

@ -22,6 +22,12 @@ CSV and TSV format both accept either a single array or scalars (representing a
XML uses the `--xml-attribute-prefix` and `xml-content-name` flags to identify attributes and content fields. XML uses the `--xml-attribute-prefix` and `xml-content-name` flags to identify attributes and content fields.
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#x20;
`yq e <exp> <file>`
{% endhint %}
## Encode value as json string ## Encode value as json string
Given a sample.yml file of: Given a sample.yml file of:
```yaml ```yaml

View File

@ -2,6 +2,12 @@
Similar to the same named functions in `jq` these functions convert to/from an object and an array of key-value pairs. This is most useful for performing operations on keys of maps. Similar to the same named functions in `jq` these functions convert to/from an object and an array of key-value pairs. This is most useful for performing operations on keys of maps.
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#x20;
`yq e <exp> <file>`
{% endhint %}
## to_entries Map ## to_entries Map
Given a sample.yml file of: Given a sample.yml file of:
```yaml ```yaml

View File

@ -17,6 +17,12 @@ yq '(.. | select(tag == "!!str")) |= envsubst' file.yaml
``` ```
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#x20;
`yq e <exp> <file>`
{% endhint %}
## Read string environment variable ## Read string environment variable
Running Running
```bash ```bash

View File

@ -12,6 +12,12 @@ It is most often used with the select operator to find particular nodes:
select(.a == .b) select(.a == .b)
``` ```
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#x20;
`yq e <exp> <file>`
{% endhint %}
## Match string ## Match string
Given a sample.yml file of: Given a sample.yml file of:
```yaml ```yaml

View File

@ -6,6 +6,12 @@ Use `eval` to dynamically process an expression - for instance from an environme
Tip: This can be useful way parameterise complex scripts. Tip: This can be useful way parameterise complex scripts.
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#x20;
`yq e <exp> <file>`
{% endhint %}
## Dynamically evaluate a path ## Dynamically evaluate a path
Given a sample.yml file of: Given a sample.yml file of:
```yaml ```yaml

View File

@ -10,6 +10,12 @@ Note the use of eval-all to ensure all documents are loaded into memory.
yq eval-all 'select(fi == 0) * select(filename == "file2.yaml")' file1.yaml file2.yaml yq eval-all 'select(fi == 0) * select(filename == "file2.yaml")' file1.yaml file2.yaml
``` ```
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#x20;
`yq e <exp> <file>`
{% endhint %}
## Get filename ## Get filename
Given a sample.yml file of: Given a sample.yml file of:
```yaml ```yaml

View File

@ -1,6 +1,12 @@
# Flatten # Flatten
This recursively flattens arrays. This recursively flattens arrays.
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#x20;
`yq e <exp> <file>`
{% endhint %}
## Flatten ## Flatten
Recursively flattens all arrays Recursively flattens all arrays

View File

@ -2,6 +2,12 @@
This is used to group items in an array by an expression. This is used to group items in an array by an expression.
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#x20;
`yq e <exp> <file>`
{% endhint %}
## Group by field ## Group by field
Given a sample.yml file of: Given a sample.yml file of:
```yaml ```yaml

View File

@ -2,6 +2,12 @@
This is operation that returns true if the key exists in a map (or index in an array), false otherwise. This is operation that returns true if the key exists in a map (or index in an array), false otherwise.
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#x20;
`yq e <exp> <file>`
{% endhint %}
## Has map key ## Has map key
Given a sample.yml file of: Given a sample.yml file of:
```yaml ```yaml

View File

@ -2,6 +2,12 @@
Use the `keys` operator to return map keys or array indices. Use the `keys` operator to return map keys or array indices.
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#x20;
`yq e <exp> <file>`
{% endhint %}
## Map keys ## Map keys
Given a sample.yml file of: Given a sample.yml file of:
```yaml ```yaml

View File

@ -2,6 +2,12 @@
Returns the lengths of the nodes. Length is defined according to the type of the node. Returns the lengths of the nodes. Length is defined according to the type of the node.
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#x20;
`yq e <exp> <file>`
{% endhint %}
## String length ## String length
returns length of string returns length of string

View File

@ -13,6 +13,12 @@ a: apple is included
b: cool b: cool
``` ```
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#x20;
`yq e <exp> <file>`
{% endhint %}
## Simple example ## Simple example
Given a sample.yml file of: Given a sample.yml file of:
```yaml ```yaml

View File

@ -2,6 +2,12 @@
Maps values of an array. Use `map_values` to map values of an object. Maps values of an array. Use `map_values` to map values of an object.
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#x20;
`yq e <exp> <file>`
{% endhint %}
## Map array ## Map array
Given a sample.yml file of: Given a sample.yml file of:
```yaml ```yaml

View File

@ -22,6 +22,12 @@ Note the use of `eval-all` to ensure all documents are loaded into memory.
yq eval-all 'select(fileIndex == 0) * select(fileIndex == 1)' file1.yaml file2.yaml yq eval-all 'select(fileIndex == 0) * select(fileIndex == 1)' file1.yaml file2.yaml
``` ```
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#x20;
`yq e <exp> <file>`
{% endhint %}
## Multiply integers ## Multiply integers
Given a sample.yml file of: Given a sample.yml file of:
```yaml ```yaml
@ -305,7 +311,7 @@ newArray:
``` ```
then then
```bash ```bash
originalPath=".myArray" otherPath=".newArray" idPath=".a" yq eval-all ' idPath=".a" originalPath=".myArray" otherPath=".newArray" yq eval-all '
( (
(( (eval(strenv(originalPath)) + eval(strenv(otherPath))) | .[] | {(eval(strenv(idPath))): .}) as $item ireduce ({}; . * $item )) as $uniqueMap (( (eval(strenv(originalPath)) + eval(strenv(otherPath))) | .[] | {(eval(strenv(idPath))): .}) as $item ireduce ({}; . * $item )) as $uniqueMap
| ( $uniqueMap | to_entries | .[]) as $item ireduce([]; . + $item.value) | ( $uniqueMap | to_entries | .[]) as $item ireduce([]; . + $item.value)

View File

@ -2,6 +2,12 @@
Parent simply returns the parent nodes of the matching nodes. Parent simply returns the parent nodes of the matching nodes.
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#x20;
`yq e <exp> <file>`
{% endhint %}
## Simple example ## Simple example
Given a sample.yml file of: Given a sample.yml file of:
```yaml ```yaml

View File

@ -4,6 +4,12 @@ The path operator can be used to get the traversal paths of matching nodes in an
You can get the key/index of matching nodes by using the `path` operator to return the path array then piping that through `.[-1]` to get the last element of that array, the key. You can get the key/index of matching nodes by using the `path` operator to return the path array then piping that through `.[-1]` to get the last element of that array, the key.
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#x20;
`yq e <exp> <file>`
{% endhint %}
## Map path ## Map path
Given a sample.yml file of: Given a sample.yml file of:
```yaml ```yaml

View File

@ -2,6 +2,12 @@
Pipe the results of an expression into another. Like the bash operator. Pipe the results of an expression into another. Like the bash operator.
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#x20;
`yq e <exp> <file>`
{% endhint %}
## Simple Pipe ## Simple Pipe
Given a sample.yml file of: Given a sample.yml file of:
```yaml ```yaml

View File

@ -19,6 +19,12 @@ For instance to set the `style` of all nodes in a yaml doc, including the map ke
```bash ```bash
yq '... style= "flow"' file.yaml yq '... style= "flow"' file.yaml
``` ```
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#x20;
`yq e <exp> <file>`
{% endhint %}
## Recurse map (values only) ## Recurse map (values only)
Given a sample.yml file of: Given a sample.yml file of:
```yaml ```yaml

View File

@ -21,6 +21,12 @@ Reduce syntax in `yq` is a little different from `jq` - as `yq` (currently) isn'
To that end, the reduce operator is called `ireduce` for backwards compatability if a `jq` like prefix version of `reduce` is ever added. To that end, the reduce operator is called `ireduce` for backwards compatability if a `jq` like prefix version of `reduce` is ever added.
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#x20;
`yq e <exp> <file>`
{% endhint %}
## Sum numbers ## Sum numbers
Given a sample.yml file of: Given a sample.yml file of:
```yaml ```yaml

View File

@ -2,6 +2,12 @@
Select is used to filter arrays and maps by a boolean expression. Select is used to filter arrays and maps by a boolean expression.
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#x20;
`yq e <exp> <file>`
{% endhint %}
## Select elements from array using wildcard prefix ## Select elements from array using wildcard prefix
Given a sample.yml file of: Given a sample.yml file of:
```yaml ```yaml

View File

@ -12,6 +12,12 @@ diff file1.yml file2.yml
Note that `yq` does not yet consider anchors when sorting by keys - this may result in invalid yaml documents if your are using merge anchors. Note that `yq` does not yet consider anchors when sorting by keys - this may result in invalid yaml documents if your are using merge anchors.
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#x20;
`yq e <exp> <file>`
{% endhint %}
## Sort keys of map ## Sort keys of map
Given a sample.yml file of: Given a sample.yml file of:
```yaml ```yaml

View File

@ -4,6 +4,12 @@ Sorts an array. Use `sort` to sort an array as is, or `sort_by(exp)` to sort by
Note that at this stage, `yq` only sorts scalar fields. Note that at this stage, `yq` only sorts scalar fields.
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#x20;
`yq e <exp> <file>`
{% endhint %}
## Sort by string field ## Sort by string field
Given a sample.yml file of: Given a sample.yml file of:
```yaml ```yaml

View File

@ -2,6 +2,12 @@
This operator splits all matches into separate documents This operator splits all matches into separate documents
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#x20;
`yq e <exp> <file>`
{% endhint %}
## Split empty ## Split empty
Running Running
```bash ```bash

View File

@ -43,6 +43,12 @@ IFS= read -rd '' output < <(cat my_file)
output=$output ./yq '.data.values = strenv(output)' first.yml output=$output ./yq '.data.values = strenv(output)' first.yml
``` ```
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#x20;
`yq e <exp> <file>`
{% endhint %}
## Join strings ## Join strings
Given a sample.yml file of: Given a sample.yml file of:
```yaml ```yaml

View File

@ -2,6 +2,12 @@
The style operator can be used to get or set the style of nodes (e.g. string style, yaml style) The style operator can be used to get or set the style of nodes (e.g. string style, yaml style)
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#x20;
`yq e <exp> <file>`
{% endhint %}
## Update and set style of a particular node (simple) ## Update and set style of a particular node (simple)
Given a sample.yml file of: Given a sample.yml file of:
```yaml ```yaml

View File

@ -2,6 +2,12 @@
You can use subtract to subtract numbers, as well as removing elements from an array. You can use subtract to subtract numbers, as well as removing elements from an array.
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#x20;
`yq e <exp> <file>`
{% endhint %}
## Array subtraction ## Array subtraction
Running Running
```bash ```bash

View File

@ -2,6 +2,12 @@
The tag operator can be used to get or set the tag of nodes (e.g. `!!str`, `!!int`, `!!bool`). The tag operator can be used to get or set the tag of nodes (e.g. `!!str`, `!!int`, `!!bool`).
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#x20;
`yq e <exp> <file>`
{% endhint %}
## Get tag ## Get tag
Given a sample.yml file of: Given a sample.yml file of:
```yaml ```yaml

View File

@ -2,6 +2,12 @@
This is the simplest (and perhaps most used) operator, it is used to navigate deeply into yaml structures. This is the simplest (and perhaps most used) operator, it is used to navigate deeply into yaml structures.
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#x20;
`yq e <exp> <file>`
{% endhint %}
## Simple map navigation ## Simple map navigation
Given a sample.yml file of: Given a sample.yml file of:
```yaml ```yaml

View File

@ -2,6 +2,12 @@
This operator is used to combine different results together. This operator is used to combine different results together.
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#x20;
`yq e <exp> <file>`
{% endhint %}
## Combine scalars ## Combine scalars
Running Running
```bash ```bash

View File

@ -2,6 +2,12 @@
This is used to filter out duplicated items in an array. This is used to filter out duplicated items in an array.
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#x20;
`yq e <exp> <file>`
{% endhint %}
## Unique array of scalars (string/numbers) ## Unique array of scalars (string/numbers)
Given a sample.yml file of: Given a sample.yml file of:
```yaml ```yaml

View File

@ -4,6 +4,12 @@ Like the `jq` equivalents, variables are sometimes required for the more complex
Note that there is also an additional `ref` operator that holds a reference (instead of a copy) of the path, allowing you to make multiple changes to the same path. Note that there is also an additional `ref` operator that holds a reference (instead of a copy) of the path, allowing you to make multiple changes to the same path.
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#x20;
`yq e <exp> <file>`
{% endhint %}
## Single value variable ## Single value variable
Given a sample.yml file of: Given a sample.yml file of:
```yaml ```yaml

View File

@ -2,6 +2,12 @@
Use the `with` operator to conveniently make multiple updates to a deeply nested path, or to update array elements relatively to each other. The first argument expression sets the root context, and the second expression runs against that root context. Use the `with` operator to conveniently make multiple updates to a deeply nested path, or to update array elements relatively to each other. The first argument expression sets the root context, and the second expression runs against that root context.
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#x20;
`yq e <exp> <file>`
{% endhint %}
## Update and style ## Update and style
Given a sample.yml file of: Given a sample.yml file of:
```yaml ```yaml

View File

@ -4,6 +4,12 @@ Encode and decode to and from JSON. Note that YAML is a _superset_ of JSON - so
This means you don't need to 'convert' a JSON file to YAML - however if you want idiomatic YAML styling, then you can use the `-P/--prettyPrint` flag, see examples below. This means you don't need to 'convert' a JSON file to YAML - however if you want idiomatic YAML styling, then you can use the `-P/--prettyPrint` flag, see examples below.
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#x20;
`yq e <exp> <file>`
{% endhint %}
## Parse json: simple ## Parse json: simple
JSON is a subset of yaml, so all you need to do is prettify the output JSON is a subset of yaml, so all you need to do is prettify the output

View File

@ -4,6 +4,12 @@ Encode to a property file (decode not yet supported). Line comments on value nod
By default, empty maps and arrays are not encoded - see below for an example on how to encode a value for these. By default, empty maps and arrays are not encoded - see below for an example on how to encode a value for these.
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#x20;
`yq e <exp> <file>`
{% endhint %}
## Encode properties ## Encode properties
Note that empty arrays and maps are not encoded by default. Note that empty arrays and maps are not encoded by default.

View File

@ -6,6 +6,12 @@ Consecutive xml nodes with the same name are assumed to be arrays.
XML content data and attributes are created as fields. This can be controlled by the `'--xml-attribute-prefix` and `--xml-content-name` flags - see below for examples. XML content data and attributes are created as fields. This can be controlled by the `'--xml-attribute-prefix` and `--xml-content-name` flags - see below for examples.
{% hint style="warning" %}
Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#x20;
`yq e <exp> <file>`
{% endhint %}
## Parse xml: simple ## Parse xml: simple
Notice how all the values are strings, see the next example on how you can fix that. Notice how all the values are strings, see the next example on how you can fix that.

View File

@ -138,8 +138,7 @@ func writeOrPanic(w *bufio.Writer, text string) {
} }
} }
func copyFromHeader(folder string, title string, out *os.File) error { func copySnippet(source string, out *os.File) error {
source := fmt.Sprintf("doc/%v/headers/%v.md", folder, title)
_, err := os.Stat(source) _, err := os.Stat(source)
if os.IsNotExist(err) { if os.IsNotExist(err) {
return nil return nil
@ -180,7 +179,14 @@ func documentScenarios(t *testing.T, folder string, title string, scenarios []in
} }
defer f.Close() defer f.Close()
err = copyFromHeader(folder, title, f) source := fmt.Sprintf("doc/%v/headers/%v.md", folder, title)
err = copySnippet(source, f)
if err != nil {
t.Error(err)
return
}
err = copySnippet("doc/notification-snippet.md", f)
if err != nil { if err != nil {
t.Error(err) t.Error(err)
return return