diff --git a/ini.go b/ini.go index e714d3d..84ba5c3 100644 --- a/ini.go +++ b/ini.go @@ -216,7 +216,7 @@ func writeGroupIni(cmd *Command, group *Group, namespace string, writer io.Write comments := (options & IniIncludeComments) != IniNone for _, option := range group.options { - if option.isFunc() || option.Hidden { + if option.Hidden || option.isFunc() && len(option.tag.Get("ini-name")) == 0 { continue } diff --git a/ini_test.go b/ini_test.go index ad4852e..7de78b0 100644 --- a/ini_test.go +++ b/ini_test.go @@ -49,6 +49,9 @@ int-map = b:3 verbose = true verbose = true +; Call phone number +call = + ; A slice of pointers to string ; PtrSlice = @@ -113,6 +116,9 @@ Opt = ; Show verbose debug information ; verbose = +; Call phone number +; call = + ; A slice of pointers to string ; PtrSlice = @@ -176,6 +182,9 @@ EnvDefault2 = env-def ; Show verbose debug information ; verbose = +; Call phone number +; call = + ; A slice of pointers to string ; PtrSlice =