Skip to content

Commit

Permalink
rename HelpFormat constants
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ardnew committed Jan 26, 2024
1 parent 788d2c4 commit d383910
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion examples/bubbletea/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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("")
Expand Down
8 changes: 4 additions & 4 deletions form.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion group.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}

Expand Down

0 comments on commit d383910

Please sign in to comment.