Skip to content

Commit

Permalink
feat: Fix SelectWithAdd(...) to include Stdout and Stdin parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
sohomdatta1 committed May 14, 2024
1 parent 7c286b3 commit 4d32aa6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions select.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bytes"
"fmt"
"io"
"os"
"text/tabwriter"
"text/template"

Expand Down Expand Up @@ -518,6 +517,9 @@ type SelectWithAdd struct {

// HideHelp sets whether to hide help information.
HideHelp bool

Stdin io.ReadCloser
Stdout io.WriteCloser
}

// Run executes the select list. Its displays the label and the list of items, asking the user to chose any
Expand All @@ -544,6 +546,8 @@ func (sa *SelectWithAdd) Run() (int, string, error) {
Size: 5,
list: list,
Pointer: sa.Pointer,
Stdin: sa.Stdin,
Stdout: sa.Stdout,
}
s.setKeys()

Expand All @@ -558,7 +562,7 @@ func (sa *SelectWithAdd) Run() (int, string, error) {
}

// XXX run through terminal for windows
os.Stdout.Write([]byte(upLine(1) + "\r" + clearLine))
sa.Stdout.Write([]byte(upLine(1) + "\r" + clearLine))
}

p := Prompt{
Expand Down

0 comments on commit 4d32aa6

Please sign in to comment.