Reorder items in generated source files.
Ideally they would always have been sorted as such, but this seems more critical in migrating from one service definition to another where the ordering might change.
This commit is contained in:
@ -2,6 +2,7 @@ package scpd
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"sort"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@ -37,6 +38,14 @@ func (scpd *SCPD) Clean() {
|
||||
}
|
||||
}
|
||||
|
||||
func (scpd *SCPD) OrderedActions() []Action {
|
||||
actions := append([]Action{}, scpd.Actions...)
|
||||
sort.SliceStable(actions, func(i, j int) bool {
|
||||
return actions[i].Name < actions[j].Name
|
||||
})
|
||||
return actions
|
||||
}
|
||||
|
||||
func (scpd *SCPD) GetStateVariable(variable string) *StateVariable {
|
||||
for i := range scpd.StateVariables {
|
||||
v := &scpd.StateVariables[i]
|
||||
|
Reference in New Issue
Block a user