pandastrike / yaml-cli

A simple CLI for querying and updating YAML files
ISC License
86 stars 5 forks source link

Non root level extends are gone #26

Open paazmaya opened 6 years ago

paazmaya commented 6 years ago

Having an input file (small.yml):

bounds: &world
  - -180
  - -85.05112877980659
  - 180
  - 85.05112877980659
_parts:
  extents84: &extents84
    extent: *world
    srsname: "WGS84"
Layer:
  - id: necountries
    geometry: linestring
    <<: *extents84
    Datasource:
      type: shape

By using the command:

yaml set small.yml _parts.extents84.srsname WSS > small2.yml

The resulting file (small2.yml):

bounds: &ref_0
  - -180
  - -85.05112877980659
  - 180
  - 85.05112877980659
_parts:
  extents84:
    extent: *ref_0
    srsname: WSS
Layer:
  - id: necountries
    geometry: linestring
    extent: *ref_0
    srsname: WGS84
    Datasource:
      type: shape

Only the root level extend, &world is preserved, while renamed to &ref_0 and the non root &extents84 has been inserted.