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"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -105,9 +106,16 @@ func prompt(dir string) (map[string]interface{}, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sort the map keys so they are consistent
|
||||||
vars := tree.ToMap()
|
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
|
var p survey.Prompt
|
||||||
switch t := v.(type) {
|
switch t := v.(type) {
|
||||||
case []string:
|
case []string:
|
||||||
|
|
Loading…
Reference in New Issue