jasperes/bash-yaml

Last character 's' is missing

MaartenSwBase opened this issue · 5 comments

test_yamls:
  -
    key: app
    file: test-app.yaml
    description: Front end code
  -
    key: tasks
    file: test-long-tasks.yaml
    description: Backend end code

After being parsed
test_yamls__key[1] holds the value task instead of tasks

Hi @MaartenSwBase

I tested here and it worked. Here my output when testing with --debug:

test_yamls__key+=("app")
test_yamls__file+=("test-app.yaml")
test_yamls__description+=("Front end code")
test_yamls__key+=("tasks")
test_yamls__file+=("test-long-tasks.yaml")
test_yamls__description+=("Backend end code")

Can you send your test.sh file and tell me what your OS?

Hi @jasperes
Thank you for such a fast response,
Here this is not the project im using yaml.sh in but I can reproduce the issue.
https://github.com/MaartenSwBase/bash-yaml
Also Im on macOs High Sierra (latest)

Another issue was opened with this same problem here: #7

The problem happens on MacOS Systems. Try the solution mentioned in this other issue.

@jasperes You can close this issue now, keep the other one open, until there is maybe another solution.

it's better to use [[:space:]] than \s.
the line sed -ne '/^--/s|--||g; s|\"|\\\"|g; s/\s*$//g;' \ is causing the issue
and replacing it with sed -ne '/^--/s|--||g; s|\"|\\\"|g; s/[[:space:]]*$//g;' \ solves it.

addressed in: #15