From 34982c122fbc38fe206c51c71f5b4df7a2b551c5 Mon Sep 17 00:00:00 2001 From: Kyle Isom Date: Sat, 6 May 2023 01:13:41 -0700 Subject: [PATCH] config: add ListKeys --- config/config.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/config/config.go b/config/config.go index bef1771..89a7e57 100644 --- a/config/config.go +++ b/config/config.go @@ -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 +}