Feature: (issue_1451) customized slice flag separator (#1546)

* feat: customized slice flag separator

* feat: modify go doc

* feat: update unit test
This commit is contained in:
GuangyuFan
2022-10-27 17:32:00 +08:00
committed by GitHub
parent 82bdf5f42e
commit 63cb372cce
5 changed files with 31 additions and 1 deletions

6
app.go
View File

@@ -103,6 +103,8 @@ type App struct {
// cli.go uses text/template to render templates. You can
// render custom help text by setting this variable.
CustomAppHelpTemplate string
// SliceFlagSeparator is used to customize the separator for SliceFlag, the default is ","
SliceFlagSeparator string
// Boolean to enable short-option handling so user can combine several
// single-character bool arguments into one
// i.e. foobar -o -v -> foobar -ov
@@ -241,6 +243,10 @@ func (a *App) Setup() {
if a.Metadata == nil {
a.Metadata = make(map[string]interface{})
}
if len(a.SliceFlagSeparator) != 0 {
defaultSliceFlagSeparator = a.SliceFlagSeparator
}
}
func (a *App) newRootCommand() *Command {