File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -253,6 +253,20 @@ function Sort-ScoopManifestRootProperties {
253
253
$null = Add-Member - InputObject $SortedObject - NotePropertyName $_ - NotePropertyValue $JsonAsObject .$_
254
254
}
255
255
256
+ # Order childs alphabetically if parent key is of type PSCustomObject
257
+ foreach (
258
+ $Key in $SortedObject .' PSObject' .' Properties' .Where{
259
+ $_ .' TypeNameOfValue' -eq ' System.Management.Automation.PSCustomObject'
260
+ }.' Name'
261
+ ) {
262
+ $ChildKeys = [string []]($SortedObject .$Key .' PSObject' .' Properties' .' Name' | Sort-Object )
263
+ $ChildObject = [PSCustomObject ]::new()
264
+ $ChildKeys.ForEach {
265
+ $null = Add-Member - InputObject $ChildObject - NotePropertyName $_ - NotePropertyValue $SortedObject .$Key .$_
266
+ }
267
+ $SortedObject .$Key = $ChildObject
268
+ }
269
+
256
270
# Return the sorted object
257
271
$SortedObject
258
272
}
You can’t perform that action at this time.
0 commit comments