summaryrefslogtreecommitdiff
path: root/usage.go
diff options
context:
space:
mode:
Diffstat (limited to 'usage.go')
-rw-r--r--usage.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/usage.go b/usage.go
index 4852866..723719a 100644
--- a/usage.go
+++ b/usage.go
@@ -27,10 +27,12 @@ func (p *Parser) WriteUsage(w io.Writer) {
}
}
- fmt.Fprintf(w, "usage: %s ", filepath.Base(os.Args[0]))
+ fmt.Fprintf(w, "usage: %s", filepath.Base(os.Args[0]))
// write the option component of the usage message
for _, spec := range options {
+ // prefix with a space
+ fmt.Fprint(w, " ")
if !spec.required {
fmt.Fprint(w, "[")
}
@@ -38,18 +40,18 @@ func (p *Parser) WriteUsage(w io.Writer) {
if !spec.required {
fmt.Fprint(w, "]")
}
- fmt.Fprint(w, " ")
}
// write the positional component of the usage message
for _, spec := range positionals {
+ // prefix with a space
+ fmt.Fprint(w, " ")
up := strings.ToUpper(spec.long)
if spec.multiple {
fmt.Fprintf(w, "[%s [%s ...]]", up, up)
} else {
fmt.Fprint(w, up)
}
- fmt.Fprint(w, " ")
}
fmt.Fprint(w, "\n")
}