fix: don't append ... for fields with an explicit type

Fixes #346
This commit is contained in:
Alec Thomas
2024-12-29 17:31:07 +09:00
parent a32b94b705
commit cacaace969
2 changed files with 17 additions and 2 deletions
+2 -2
View File
@@ -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