Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions cmd/nightshift/commands/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ func runConfigGet(key string) error {

// Format output based on type
switch val := value.(type) {
case map[string]interface{}:
case map[string]any:
printMap(val, 0)
case []interface{}:
case []any:
printSlice(val, 0)
default:
fmt.Println(value)
Expand Down Expand Up @@ -316,7 +316,7 @@ func validateConfigFile(path string) error {
return config.Validate(&cfg)
}

func parseValue(value string) interface{} {
func parseValue(value string) any {
// Try to parse as bool
if value == "true" {
return true
Expand Down Expand Up @@ -425,14 +425,14 @@ func isZero(v reflect.Value) bool {
}
}

func printMap(m map[string]interface{}, indent int) {
func printMap(m map[string]any, indent int) {
prefix := strings.Repeat(" ", indent)
for k, v := range m {
switch val := v.(type) {
case map[string]interface{}:
case map[string]any:
fmt.Printf("%s%s:\n", prefix, k)
printMap(val, indent+1)
case []interface{}:
case []any:
fmt.Printf("%s%s:\n", prefix, k)
printSlice(val, indent+1)
default:
Expand All @@ -441,11 +441,11 @@ func printMap(m map[string]interface{}, indent int) {
}
}

func printSlice(s []interface{}, indent int) {
func printSlice(s []any, indent int) {
prefix := strings.Repeat(" ", indent)
for _, v := range s {
switch val := v.(type) {
case map[string]interface{}:
case map[string]any:
fmt.Printf("%s-\n", prefix)
printMap(val, indent+1)
default:
Expand Down