Sort map keys for consistency
Signed-off-by: jolheiser <john.olheiser@gmail.com>pull/7/head
parent
c5bf199b84
commit
e4342f9a04
|
@ -6,6 +6,7 @@ import (
|
|||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
@ -105,9 +106,16 @@ func prompt(dir string) (map[string]interface{}, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
// Sort the map keys so they are consistent
|
||||
vars := tree.ToMap()
|
||||
sorted := make([]string, 0, len(vars))
|
||||
for k := range vars {
|
||||
sorted = append(sorted, k)
|
||||
}
|
||||
sort.Strings(sorted)
|
||||
|
||||
for k, v := range vars {
|
||||
for _, k := range sorted {
|
||||
v := vars[k]
|
||||
var p survey.Prompt
|
||||
switch t := v.(type) {
|
||||
case []string:
|
||||
|
|
Loading…
Reference in New Issue