Fixes #125: Support custom per-mapper placeholder text (#169)

This commit is contained in:
andrewbaxter
2021-05-17 20:31:07 +09:00
committed by GitHub
parent 9c81441ae0
commit b3bdeb18e2
4 changed files with 42 additions and 0 deletions
+4
View File
@@ -397,6 +397,10 @@ func (f *Flag) String() string {
// FormatPlaceHolder formats the placeholder string for a Flag.
func (f *Flag) FormatPlaceHolder() string {
placeholderHelper, ok := f.Value.Mapper.(PlaceHolderProvider)
if ok {
return placeholderHelper.PlaceHolder(f)
}
tail := ""
if f.Value.IsSlice() && f.Value.Tag.Sep != -1 {
tail += string(f.Value.Tag.Sep) + "..."