opt-multi: changed the help template
This commit is contained in:
parent
4111864916
commit
f55e9cea82
14
opt-multi.go
14
opt-multi.go
@ -1,6 +1,9 @@
|
|||||||
package cli
|
package cli
|
||||||
|
|
||||||
import "strconv"
|
import (
|
||||||
|
"fmt"
|
||||||
|
"strconv"
|
||||||
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
multiTypeName = "num"
|
multiTypeName = "num"
|
||||||
@ -34,8 +37,13 @@ func (opt *cliOptionMulti) getDefaultValue() string {
|
|||||||
return strconv.Itoa(opt.defaultValue)
|
return strconv.Itoa(opt.defaultValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (opt *cliOptionMulti) getTemplate() string {
|
func (opt *cliOptionMulti) getTemplate() (templ string) {
|
||||||
return opt.makeOptTemplate(false, multiTypeName)
|
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) {
|
func (opt *cliOptionMulti) parse(parser cliParser, argIndex int, valuePtr *string) (skipNextArg bool, err error) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user