From a4054e58070b090de775a2ef3559bee9f766d2f3 Mon Sep 17 00:00:00 2001 From: janbar Date: Tue, 23 Apr 2024 17:46:42 +0800 Subject: [PATCH 1/2] fix(vfox config -l): show all configurations show configuration includes value as empty string --- cmd/commands/config.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cmd/commands/config.go b/cmd/commands/config.go index 7fa61f4c..f7227ae0 100644 --- a/cmd/commands/config.go +++ b/cmd/commands/config.go @@ -2,11 +2,12 @@ package commands import ( "fmt" - "github.com/urfave/cli/v2" - "github.com/version-fox/vfox/internal" "reflect" "strconv" "strings" + + "github.com/urfave/cli/v2" + "github.com/version-fox/vfox/internal" ) var Config = &cli.Command{ @@ -69,9 +70,10 @@ func configList(prefix string, v reflect.Value) { configList(prefix+key+".", value) } else { if value.Kind() == reflect.String && value.IsZero() { - continue + fmt.Println(prefix + key + ` = ""`) + } else { + fmt.Printf(prefix+key+" = %v\n", value.Interface()) } - fmt.Printf(prefix+key+" = %v\n", value.Interface()) } } } From 5285e42da1f65189bbf1eeff22c3632e9076b850 Mon Sep 17 00:00:00 2001 From: janbar Date: Tue, 23 Apr 2024 19:54:41 +0800 Subject: [PATCH 2/2] fix(vfox config -l): show all configurations similar to `git config --list` to display all configurations --- cmd/commands/config.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/cmd/commands/config.go b/cmd/commands/config.go index f7227ae0..dc15052b 100644 --- a/cmd/commands/config.go +++ b/cmd/commands/config.go @@ -69,11 +69,7 @@ func configList(prefix string, v reflect.Value) { if (value.Kind() == reflect.Ptr && value.Elem().Kind() == reflect.Struct) || value.Kind() == reflect.Struct { configList(prefix+key+".", value) } else { - if value.Kind() == reflect.String && value.IsZero() { - fmt.Println(prefix + key + ` = ""`) - } else { - fmt.Printf(prefix+key+" = %v\n", value.Interface()) - } + fmt.Printf(prefix+key+" = %v\n", value.Interface()) } } }