Skip to content

Commit

Permalink
Merge pull request #29 from ggiamarchi/update-config-list
Browse files Browse the repository at this point in the history
Update config list
  • Loading branch information
ggiamarchi authored Apr 9, 2020
2 parents ba03b6d + 5f0a7d4 commit cfbf907
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# PXE Pilot compiled Binary
#
pxe-pilot
pxe-pilot-linux-amd64

#
# PXE Configuration generated by PXE Pilots
Expand Down
2 changes: 1 addition & 1 deletion cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func setupCLI() {
}
})

app.Command("bootloaders", "Bootloaders configuration commands", func(cmd *cli.Cmd) {
app.Command("bootloader", "Bootloaders configuration commands", func(cmd *cli.Cmd) {
cmd.Command("list", "List available bootloaders", func(cmd *cli.Cmd) {
cmd.Action = func() {
logger.Init(!*debug)
Expand Down
7 changes: 7 additions & 0 deletions service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package service
import (
"io/ioutil"
"os"
"sort"
"strings"
"sync"

Expand Down Expand Up @@ -51,6 +52,12 @@ func ReadConfigurations(appConfig *model.AppConfig) []*model.Configuration {
configurations := make([]*model.Configuration, 0)
for _, bootloader := range appConfig.Configuration.Bootloaders {
files, _ := ioutil.ReadDir(appConfig.Configuration.Directory + "/" + bootloader.Name)

// Sort by age, keeping original order or equal elements.
sort.SliceStable(files, func(i, j int) bool {
return strings.Compare(files[i].Name(), files[j].Name()) < 1
})

for _, f := range files {
configuration := &model.Configuration{
Name: f.Name(),
Expand Down
Empty file.
Empty file.
Empty file.
Empty file.

0 comments on commit cfbf907

Please sign in to comment.