Fix merge conflicts
This commit is contained in:
parent
b0d37d1fb2
commit
670c7b787d
10
usage.go
10
usage.go
|
@ -5,6 +5,7 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -76,6 +77,7 @@ func (p *Parser) WriteHelp(w io.Writer) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// write the list of options
|
||||||
fmt.Fprint(w, "\noptions:\n")
|
fmt.Fprint(w, "\noptions:\n")
|
||||||
for _, spec := range options {
|
for _, spec := range options {
|
||||||
printOption(w, spec)
|
printOption(w, spec)
|
||||||
|
@ -103,9 +105,11 @@ func printOption(w io.Writer, spec *spec) {
|
||||||
// Check if spec.dest is zero value or not
|
// Check if spec.dest is zero value or not
|
||||||
// If it isn't a default value have been added
|
// If it isn't a default value have been added
|
||||||
v := spec.dest
|
v := spec.dest
|
||||||
z := reflect.Zero(v.Type())
|
if v.IsValid() {
|
||||||
if v.Interface() != z.Interface() {
|
z := reflect.Zero(v.Type())
|
||||||
fmt.Fprintf(w, " [default: %v]", v)
|
if v.Interface() != z.Interface() {
|
||||||
|
fmt.Fprintf(w, " [default: %v]", v)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
fmt.Fprint(w, "\n")
|
fmt.Fprint(w, "\n")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue