Option types: bool int, int-array, string, string-array, string-map, file, dir
37 lines
667 B
Go
37 lines
667 B
Go
package cli
|
|
|
|
import (
|
|
"io"
|
|
)
|
|
|
|
type cliOptionVersion struct {
|
|
cliOptionBase
|
|
}
|
|
|
|
func (opt *cliOptionVersion) init() {
|
|
}
|
|
|
|
func (opt *cliOptionVersion) requiresValue() bool {
|
|
return false
|
|
}
|
|
|
|
func (opt *cliOptionVersion) getDefaultValue() string {
|
|
return ""
|
|
}
|
|
|
|
func (opt *cliOptionVersion) getTemplate() string {
|
|
return opt.makeOptSimpleTemplate(false, true, "section")
|
|
}
|
|
|
|
func (opt *cliOptionVersion) parse(parser cliParser, argIndex int, valuePtr *string) (skipNextArg bool, err error) {
|
|
var args []string
|
|
if valuePtr != nil {
|
|
args = []string{*valuePtr}
|
|
} else {
|
|
args = parser.getCliArgs(argIndex+2, -1)
|
|
}
|
|
parser.PrintVersion(args)
|
|
err = io.EOF
|
|
return
|
|
}
|