opt-multi: changed the help template

This commit is contained in:
Celestino Amoroso 2026-02-04 05:54:49 +01:00
parent 4111864916
commit f55e9cea82

View File

@ -1,6 +1,9 @@
package cli
import "strconv"
import (
"fmt"
"strconv"
)
const (
multiTypeName = "num"
@ -34,8 +37,13 @@ func (opt *cliOptionMulti) getDefaultValue() string {
return strconv.Itoa(opt.defaultValue)
}
func (opt *cliOptionMulti) getTemplate() string {
return opt.makeOptTemplate(false, multiTypeName)
func (opt *cliOptionMulti) getTemplate() (templ string) {
if opt.shortAlias != "" {
templ = fmt.Sprintf(`-%s, --%s`, opt.shortAlias, opt.name)
} else {
templ = fmt.Sprintf(`--%s`, opt.name)
}
return
}
func (opt *cliOptionMulti) parse(parser cliParser, argIndex int, valuePtr *string) (skipNextArg bool, err error) {