feat: add FlagNamer option

Fixes #347
This commit is contained in:
Alec Thomas
2023-01-13 09:33:59 -05:00
parent 919e70103f
commit 95a465b4b5
5 changed files with 28 additions and 6 deletions
+10
View File
@@ -2,6 +2,7 @@ package kong
import (
"reflect"
"strings"
"testing"
"github.com/alecthomas/assert/v2"
@@ -112,3 +113,12 @@ func TestBindToProvider(t *testing.T) {
assert.NoError(t, err)
assert.True(t, cli.Called)
}
func TestFlagNamer(t *testing.T) {
var cli struct {
SomeFlag string
}
app, err := New(&cli, FlagNamer(strings.ToUpper))
assert.NoError(t, err)
assert.Equal(t, "SOMEFLAG", app.Model.Flags[1].Name)
}