Use positional-arg-name tag
diff --git a/command_private.go b/command_private.go
index 1727a30..5d30a8a 100644
--- a/command_private.go
+++ b/command_private.go
@@ -43,7 +43,7 @@
return true, err
}
- name := m.Get("name")
+ name := m.Get("positional-arg-name")
if len(name) == 0 {
name = field.Name
diff --git a/flags.go b/flags.go
index 9d7d571..37d331d 100644
--- a/flags.go
+++ b/flags.go
@@ -134,6 +134,10 @@
Positional arguments are optional by default,
unless the "required" tag is specified together
with the "positional-args" tag (optional)
+ positional-arg-name: used on a field in a positional argument struct; name
+ of the positional argument placeholder to be shown in
+ the help (optional)
+
Either the `short:` tag or the `long:` must be specified to make the field eligible as an
option.
diff --git a/help_test.go b/help_test.go
index 32220fb..c7ef1ee 100644
--- a/help_test.go
+++ b/help_test.go
@@ -41,8 +41,8 @@
} `command:"command" alias:"cm" alias:"cmd" description:"A command"`
Args struct {
- Filename string `name:"filename" description:"A filename"`
- Num int `name:"num" description:"A number"`
+ Filename string `positional-arg-name:"filename" description:"A filename"`
+ Number int `positional-arg-name:"num" description:"A number"`
} `positional-args:"yes"`
}