-
I would like to order a yaml map by value Here is the document I want to sort Right now, it is sorted Here is an example of what I want to sort ---
action:
name: replace
extends: substitution
ignorecase: true
level: warning
message: Use '%s' instead of '%s'
swap:
(?<!\.)HTML: HTML
i18n: i18n
Homebrew: Homebrew
(?<!\.)HTMX: HTMX
HTTP(?!:): HTTP I would like the order to be this one, so ordered by the value of the map. ---
action:
name: replace
extends: substitution
ignorecase: true
level: warning
message: Use '%s' instead of '%s'
swap:
Homebrew: Homebrew
(?<!\.)HTML: HTML # also a file extension
(?<!\.)HTMX: HTMX # also a file extension
HTTP(?!:): HTTP
i18n: i18n I tried multiple things, looked at the doc twice, looked at discussion here or stack overflow. So here I am. Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Found it after reading the documentation again, and playing with map to array conversion
to_entries/from_entries =>https://mikefarah.gitbook.io/yq/operators/entries#from_entries-map |
Beta Was this translation helpful? Give feedback.
Found it after reading the documentation again, and playing with map to array conversion
to_entries/from_entries =>https://mikefarah.gitbook.io/yq/operators/entries#from_entries-map
sort_by => https://mikefarah.gitbook.io/yq/operators/sort-keys
downcase => https://mikefarah.gitbook.io/yq/operators/string-operators