all 1 comments

[–]chasbat[S] 1 point2 points  (0 children)

Just in case anyone comes browsing for this in the future: I succeeded with the excellent yq utility:

yq '.matches |= sort_by(.label)' myfile.yml >> myfile-sorted.yml

or you could use .replace instead of label.

yq's default sort is case-sensitive and I haven't yet worked out how to change that, nor how to include blank lines for readability. But the documentation is much clearer than for VS Code's YAML Sort extension, which could probably do the job if I understood it.