config: add ListKeys

This commit is contained in:
Kyle Isom 2023-05-06 01:13:41 -07:00
parent fb11c0c27c
commit 34982c122f
1 changed files with 12 additions and 0 deletions

View File

@ -13,6 +13,7 @@ import (
"fmt"
"log"
"os"
"sort"
"strings"
"git.wntrmute.dev/kyle/goutils/config/iniconf"
@ -139,3 +140,14 @@ func Require(key string) string {
return v
}
// ListKeys returns a slice of the currently known keys.
func ListKeys() []string {
keyList := []string{}
for k := range vars {
keyList = append(keyList, k)
}
sort.Strings(keyList)
return keyList
}