Skip to content

Square brackets syntax in yaml #278

Description

@js361014

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions