varadic optional arguments, #213

This commit is contained in:
Josh Baker 2017-08-24 10:11:16 -07:00
parent 9cdbea19c1
commit e71c7af21b
2 changed files with 10 additions and 2 deletions

View File

@ -105,7 +105,11 @@ func (a Argument) String() string {
subs = strings.TrimSpace(subs)
s += " " + subs
if a.Variadic {
s += " [" + subs + " ...]"
if len(names) == 0 {
s += " [" + subs + " ...]"
} else {
s += " [" + names[len(names)-1] + " ...]"
}
}
if a.Multiple {
s += " ..."

View File

@ -105,7 +105,11 @@ func (a Argument) String() string {
subs = strings.TrimSpace(subs)
s += " " + subs
if a.Variadic {
s += " [" + subs + " ...]"
if len(names) == 0 {
s += " [" + subs + " ...]"
} else {
s += " [" + names[len(names)-1] + " ...]"
}
}
if a.Multiple {
s += " ..."