poetry2nix/overrides/sort-build-systems.jq
Victor Engmark d5ea9cde13
feat: Put all string values before objects
String entries apply to _all_ versions, so it makes sense for them to be
first in the build systems lists.
2023-09-26 14:15:14 +13:00

16 lines
430 B
Text

# Sort each entry in the top-level dictionary
.[] |= sort_by(
# Put all strings before objects
type == "object",
if type == "string"
then
# Sort string overrides alphabetically
.
else
# Sort entries with an `until` field above entries with a `from` field
.from,
.until,
# Sort build systems with the same `from` and `until` values
.buildSystem
end
)