From d38391026862af53702b36cea213772271623fac Mon Sep 17 00:00:00 2001 From: ardnew Date: Fri, 26 Jan 2024 16:41:49 -0600 Subject: [PATCH] rename HelpFormat constants The previous constants did not follow the same naming convention as other exported enumerated types. For example, type "FormState" uses the noun "Form" followed by attribute "State", while the constants of that type use the attribute followed by a unique description (e.g., "Normal" from identifier "StateNormal"). Also, the previous descriptions "Short" versus "Full" did not complement each other. These were updated to be antonyms so that someone can easily figure out an alternative from a known identifier. --- examples/bubbletea/main.go | 2 +- form.go | 8 ++++---- group.go | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/bubbletea/main.go b/examples/bubbletea/main.go index 32784cad..cd24fb5e 100644 --- a/examples/bubbletea/main.go +++ b/examples/bubbletea/main.go @@ -206,7 +206,7 @@ func (m Model) View() string { } body := lipgloss.JoinHorizontal(lipgloss.Top, form, status) - keys := m.form.KeyBindsHelp(huh.ShortHelp) + keys := m.form.KeyBindsHelp(huh.FormatShort) footer := m.appBoundaryView(m.form.Help().ShortHelpView(keys)) if len(errors) > 0 { footer = m.appErrorBoundaryView("") diff --git a/form.go b/form.go index 95585303..ba2f7098 100644 --- a/form.go +++ b/form.go @@ -151,11 +151,11 @@ type Field interface { type HelpFormat int const ( - // FullHelp is the full-size help format. - FullHelp HelpFormat = iota + // FormatLong is the full-size default help format. + FormatLong HelpFormat = iota - // ShortHelp is the one-line summary help format. - ShortHelp + // FormatShort is the one-line summary help format. + FormatShort ) // FieldPosition is positional information about the given field and form. diff --git a/group.go b/group.go index da711cad..f9be7b5d 100644 --- a/group.go +++ b/group.go @@ -287,7 +287,7 @@ func (g *Group) View() string { g.viewport.SetContent(fields.String() + "\n") if g.showHelp && len(errors) <= 0 { - keys := g.fields[g.paginator.Page].KeyBindsHelp(ShortHelp) + keys := g.fields[g.paginator.Page].KeyBindsHelp(FormatShort) view.WriteString(g.help.ShortHelpView(keys)) }