TUN-3766: Print flags defined at all levels of command hierarchy, not just locally defined flags for a command. This fixes output of overriden settings for subcommand.

This commit is contained in:
Igor Postelnik 2021-01-15 14:25:20 -06:00 committed by Arég Harutyunyan
parent 04b1e4f859
commit 4a76ed12e7
1 changed files with 2 additions and 9 deletions

View File

@ -61,19 +61,12 @@ func generateRandomClientID(log *zerolog.Logger) (string, error) {
func logClientOptions(c *cli.Context, log *zerolog.Logger) {
flags := make(map[string]interface{})
for _, flag := range c.LocalFlagNames() {
for _, flag := range c.FlagNames() {
flags[flag] = c.Generic(flag)
}
sliceFlags := []string{"header", "tag", "proxy-dns-upstream", "upstream", "edge"}
for _, sliceFlag := range sliceFlags {
if len(c.StringSlice(sliceFlag)) > 0 {
flags[sliceFlag] = strings.Join(c.StringSlice(sliceFlag), ", ")
}
}
if len(flags) > 0 {
log.Info().Msgf("Environment variables %v", flags)
log.Info().Msgf("Settings: %v", flags)
}
envs := make(map[string]string)