first commit status: option and argument parsing, short aliases grouping, special values, hidden options

Option types: bool int, int-array, string, string-array, string-map, file, dir
This commit is contained in:
2025-12-11 07:57:48 +01:00
parent b9a4efc956
commit 38e36839f8
22 changed files with 1604 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
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
}