Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Square brackets syntax in yaml #278

Open
js361014 opened this issue Dec 28, 2022 · 3 comments
Open

Square brackets syntax in yaml #278

js361014 opened this issue Dec 28, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@js361014
Copy link

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.

@js361014 js361014 added the bug Something isn't working label Dec 28, 2022
@TomWright
Copy link
Owner

Dasel uses the following package for yaml parsing: https://github.com/go-yaml/yaml

I can do some digging to see if there is a workaround for this.

@TomWright
Copy link
Owner

I believe I have fixed this here: #289

The PR is still a WIP but a fix should be coming soon.

@TomWright
Copy link
Owner

It looks like the issue is still present.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants