#278·dasel

Square brackets syntax in yaml

Author: js361014Created Dec 28, 2022Updated Aug 29, 2023
Labelsbug

Discussion? In yaml there is default syntax for array list:

key1:
  - value1
  - value2
  - value3
  - value4
  - value5

and square brackets syntax:

key1: [value1,value2,value3,value4,value5]

Describe the bug Dasel doesn't handle square brackets syntax for array list in yaml.

To Reproduce

$> cat <<EOF | tee tmp.yaml
key1: [value1,value2,value3,value4,value5]
key2: value6
EOF

$> dasel put -f tmp.yaml -r yaml -w yaml -v "value7" 'key2'
$> cat tmp.yaml
key1:
- value1
- value2
- value3
- value4
- value5
key2: value7

Expected behavior The output should be:

key1: [value1,value2,value3,value4,value5]
key2: value7

Desktop (please complete the following information):

  • OS: 20.04.1-Ubuntu
  • Version v2.0.2

Additional context Square brackets syntax is used in docker-compose.yml files.