Skip to content

Commit 637ea19

Browse files
committed
Better syntax printing
1 parent b5669a7 commit 637ea19

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

pkg/config/config.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,20 @@ func InitConfig(cm *Config) {
121121
// Setup a slightly non-default error handler that gets called if there are problems parsing the command line parms
122122
flag.Usage = func() {
123123

124-
fmt.Fprintf(flag.CommandLine.Output(), "Usage of %s: \n", os.Args[0])
124+
o := flag.CommandLine.Output()
125+
fmt.Fprintf(o, "Usage of %s: \n", os.Args[0])
125126
flag.PrintDefaults()
126127

127-
fmt.Fprintf(flag.CommandLine.Output(), "\n\nValid environment variables for configuration are : ")
128+
fmt.Fprintf(o, "\n\nValid environment variables for configuration are :\n")
129+
i:= 0
128130
for _, k := range keys {
129-
fmt.Fprintf(flag.CommandLine.Output(), "%s ", k)
131+
fmt.Fprintf(o, "%-32s ", k)
132+
i++
133+
if i % 5 == 0 {
134+
fmt.Fprintf(o,"\n")
135+
}
130136
}
131-
fmt.Fprintf(flag.CommandLine.Output(), "\n")
137+
fmt.Fprintf(o, "\n")
132138
}
133139

134140
// Setup the CLI flags and the equivalent Environment variable names. The env vars are named

0 commit comments

Comments
 (0)