@@ -2460,3 +2460,18 @@ func TestApplyCalledOnce(t *testing.T) {
|
||||
err = kctx.Run()
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
||||
func TestCustomTypeNoEllipsis(t *testing.T) {
|
||||
type CLI struct {
|
||||
Flag []byte `type:"existingfile"`
|
||||
}
|
||||
var cli CLI
|
||||
p := mustNew(t, &cli, kong.Exit(func(int) {}))
|
||||
w := &strings.Builder{}
|
||||
p.Stderr = w
|
||||
p.Stdout = w
|
||||
_, err := p.Parse([]string{"--help"})
|
||||
assert.NoError(t, err)
|
||||
help := w.String()
|
||||
assert.NotContains(t, help, "...")
|
||||
}
|
||||
|
||||
@@ -433,7 +433,7 @@ func (f *Flag) FormatPlaceHolder() string {
|
||||
return placeholderHelper.PlaceHolder(f)
|
||||
}
|
||||
tail := ""
|
||||
if f.Value.IsSlice() && f.Value.Tag.Sep != -1 {
|
||||
if f.Value.IsSlice() && f.Value.Tag.Sep != -1 && f.Tag.Type == "" {
|
||||
tail += string(f.Value.Tag.Sep) + "..."
|
||||
}
|
||||
if f.PlaceHolder != "" {
|
||||
@@ -446,7 +446,7 @@ func (f *Flag) FormatPlaceHolder() string {
|
||||
return f.Default + tail
|
||||
}
|
||||
if f.Value.IsMap() {
|
||||
if f.Value.Tag.MapSep != -1 {
|
||||
if f.Value.Tag.MapSep != -1 && f.Tag.Type == "" {
|
||||
tail = string(f.Value.Tag.MapSep) + "..."
|
||||
}
|
||||
return "KEY=VALUE" + tail
|
||||
|
||||
Reference in New Issue
Block a user