add final checks on option values

This commit is contained in:
2026-03-05 22:30:07 +01:00
parent b5f8d9eaab
commit 95fae40d5f
15 changed files with 219 additions and 37 deletions
+6 -1
View File
@@ -46,12 +46,17 @@ func (opt *cliOptionMulti) getTemplate() (templ string) {
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, value string, err error) {
if opt.targetVar != nil {
*opt.targetVar++
}
value = "true"
return
}
func (opt *cliOptionMulti) finalCheck(cliValue string) (err error) {
currentValue, _ := opt.getTargetVar()
return opt.getBase().checkValue(cliValue, currentValue)
}
func (cli *CliParser) AddMultiOpt(name, short string, targetVar *int, defaultValue int, description string, aliases ...string) OptReference {
if cli.optionExists(name, short, aliases) {