Skip to content

Commit

Permalink
refactored WithXxx functions that set boolean options
Browse files Browse the repository at this point in the history
  • Loading branch information
MarvinJWendt committed Sep 19, 2022
1 parent 0ca1b0d commit b17aa32
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 4 additions & 2 deletions interactive_continue_printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (
"atomicgo.dev/keyboard/keys"
"golang.org/x/text/cases"
"golang.org/x/text/language"

"github.com/pterm/pterm/internal"
)

var (
Expand Down Expand Up @@ -89,8 +91,8 @@ func (p InteractiveContinuePrinter) WithHandles(handles []string) *InteractiveCo

// WithShowShortHandles will set ShowShortHandles to true
// this makes the printer display the shorthand options instead their shorthand version.
func (p InteractiveContinuePrinter) WithShowShortHandles() *InteractiveContinuePrinter {
p.ShowShortHandles = true
func (p InteractiveContinuePrinter) WithShowShortHandles(b ...bool) *InteractiveContinuePrinter {
p.ShowShortHandles = internal.WithBoolean(b)
return &p
}

Expand Down
3 changes: 1 addition & 2 deletions panel_printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ func (p PanelPrinter) WithBottomPadding(bottomPadding int) *PanelPrinter {

// WithSameColumnWidth returns a new PanelPrinter with specific options.
func (p PanelPrinter) WithSameColumnWidth(b ...bool) *PanelPrinter {
b2 := internal.WithBoolean(b)
p.SameColumnWidth = b2
p.SameColumnWidth = internal.WithBoolean(b)
return &p
}

Expand Down

0 comments on commit b17aa32

Please sign in to comment.