- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 711
 
Closed
Description
Prefix is printed if no hit with select(kind == ...)
Following the example from https://mikefarah.gitbook.io/yq/recipes#export-as-environment-variables-script-or-any-custom-format I added a prefix to the output. Up to 4.45.2 all was fine but at least since 4.45.4 the prefix is printed if no match found
Version of yq: 4.45.4
Operating system: windows/....
Installed via: manually
Input Yaml
data1.yml:
# a: 1
# b: 2
# fruit:
#   - apple
#   - banana
#   - peachCommand
The command you ran:
yq '.. | (
  ( select(kind == "scalar" and parent | kind != "seq") |
      "scalar_" + key + "='\''" + . + "'\''" ),
  ( select(kind == "seq") |
      "seq_" + key + "=(" + (map("'\''" + . + "'\''") | join(",")) + ")")
)' data1.yml
Actual behavior
scalar_
seq_Expected behavior
no outputAdditional context
Uncomment scalars or sequence and all is fine.