FEAT: randomize room number
randomize room number when not set but the night number is set
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
"path"
|
||||
"path/filepath"
|
||||
"slices"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/charmbracelet/lipgloss"
|
||||
@@ -128,7 +129,15 @@ Splash2len=%d
|
||||
// loop through folders
|
||||
log.Info("")
|
||||
roomcredits := []string{}
|
||||
for _, roomFolder := range roomFolders {
|
||||
|
||||
sortedRoomFolders := make([]RoomFolder, len(roomFolders))
|
||||
copy(sortedRoomFolders, roomFolders)
|
||||
|
||||
sort.Slice(sortedRoomFolders, func(i, j int) bool {
|
||||
return sortedRoomFolders[i].Cfg.night < sortedRoomFolders[j].Cfg.night || (sortedRoomFolders[i].Cfg.night == sortedRoomFolders[j].Cfg.night && sortedRoomFolders[i].Cfg.room < sortedRoomFolders[j].Cfg.room)
|
||||
})
|
||||
|
||||
for _, roomFolder := range sortedRoomFolders {
|
||||
err := copyFolder(&roomFolder, outpath)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error copying folder %s: %+v", roomFolder.Path, err)
|
||||
@@ -153,7 +162,7 @@ Splash2len=%d
|
||||
}
|
||||
|
||||
// save credits file
|
||||
creditsstring := strings.Join(roomcredits, "\n")
|
||||
creditsstring := strings.Join(roomcredits, "\n\n") + "\n"
|
||||
|
||||
outcredits := filepath.Join(outpath, "credits.txt")
|
||||
log.Info(Renderf(styleGreentext, "Writing %s", outcredits))
|
||||
|
||||
Reference in New Issue
Block a user