Only print [OPTIONS] when there are options
diff --git a/command_private.go b/command_private.go
index bf0d0f8..0195a46 100644
--- a/command_private.go
+++ b/command_private.go
@@ -161,3 +161,17 @@
sort.Sort(ret)
return []*Command(ret)
}
+
+func (c *Command) hasCliOptions() bool {
+ ret := false
+
+ c.eachGroup(func (g *Group) {
+ for _, opt := range g.options {
+ if opt.canCli() {
+ ret = true
+ }
+ }
+ })
+
+ return ret
+}
diff --git a/help.go b/help.go
index a3146e5..05bdc23 100644
--- a/help.go
+++ b/help.go
@@ -221,12 +221,12 @@
if allcmd == p.Command {
if len(p.Usage) != 0 {
usage = p.Usage
- } else {
+ } else if p.hasCliOptions() {
usage = "[OPTIONS]"
}
} else if us, ok := allcmd.data.(Usage); ok {
usage = us.Usage()
- } else {
+ } else if allcmd.hasCliOptions() {
usage = fmt.Sprintf("[%s-OPTIONS]", allcmd.Name)
}