add final checks on option values
This commit is contained in:
+6
-2
@@ -43,8 +43,7 @@ func (opt *cliOptionStringArray) getTemplate() string {
|
||||
|
||||
// parse retrieves the option value from the parser and updates the target variable.
|
||||
// It handles comma-separated values and special values if configured.
|
||||
func (opt *cliOptionStringArray) parse(parser cliParser, argIndex int, valuePtr *string) (skipNextArg bool, err error) {
|
||||
var value string
|
||||
func (opt *cliOptionStringArray) parse(parser cliParser, argIndex int, valuePtr *string) (skipNextArg bool, value string, err error) {
|
||||
if value, skipNextArg, err = opt.fetchOptionValue(parser, argIndex, valuePtr); err == nil {
|
||||
var boxedValue any
|
||||
if boxedValue, err = opt.getSpecialValue(parser, value, opt.targetVar); err == nil {
|
||||
@@ -85,3 +84,8 @@ func (cli *CliParser) AddStringArrayOpt(name, short string, targetVar *[]string,
|
||||
cli.options = append(cli.options, opt)
|
||||
return opt
|
||||
}
|
||||
|
||||
func (opt *cliOptionStringArray) finalCheck(cliValue string) (err error) {
|
||||
currentValue, _ := opt.getTargetVar()
|
||||
return opt.getBase().checkValue(cliValue, currentValue)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user