align help
This commit is contained in:
parent
8dfd5378c0
commit
cf1331e3cd
15
envconf.go
15
envconf.go
@ -118,23 +118,20 @@ func (c *Config) Parse() {
|
||||
}
|
||||
|
||||
func (c *Config) Help() {
|
||||
max := 0
|
||||
max := make([]int, 2, 2)
|
||||
for k, v := range c.env {
|
||||
if v.dtype != TypeNone {
|
||||
if len(k) > max {
|
||||
max = len(k)
|
||||
if len(k) > max[0] {
|
||||
max[0] = len(k)
|
||||
}
|
||||
if len(v.dtype.String()) > max {
|
||||
max = len(v.dtype.String())
|
||||
}
|
||||
if len(v.value) > max {
|
||||
max = len(v.value)
|
||||
if len(v.dtype.String()) > max[1] {
|
||||
max[1] = len(v.dtype.String())
|
||||
}
|
||||
}
|
||||
}
|
||||
for k, v := range c.env {
|
||||
if v.dtype != TypeNone {
|
||||
format := fmt.Sprintf("Variable %%%ds|Type %%%ds|Default %%s\n", max, max)
|
||||
format := fmt.Sprintf("Variable %%-%ds| Type %%-%ds| Default %%s\n", max[0]+3, max[1]+3)
|
||||
fmt.Printf(format, k, v.dtype, v.value)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user