Skip to content

Commit

Permalink
fix: windows scan user input
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaizhai committed Sep 13, 2022
1 parent ab99d24 commit 0c3937f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions pkg/boilr/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ const (
TemplateMetadataName = "__metadata.json"

// GithubOwner is the owner of the github repository
GithubOwner = "6uhrmittag"
GithubOwner = "Li-AnLin"

// GithubRepo is the name of the github repository
GithubRepo = "6uhrmittag"
GithubRepo = "Li-AnLin"
)

// Configuration contains the values for needed for boilr to operate.
Expand Down
13 changes: 6 additions & 7 deletions pkg/prompt/prompt.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"fmt"
"os"
"strconv"
"strings"

"github.com/Li-AnLin/boilr/pkg/util/tlog"
)
Expand All @@ -29,7 +28,7 @@ func (p strPrompt) PromptMessage(name string) string {
}

func (p strPrompt) EvaluateChoice(c string) (interface{}, error) {
if c != "" {
if len(c) > 0 {
return c, nil
}

Expand Down Expand Up @@ -108,13 +107,13 @@ func Func(defval interface{}) Interface {
}

func scanLine() (string, error) {
input := bufio.NewReader(os.Stdin)
line, err := input.ReadString('\n')
if err != nil {
return line, err
input := bufio.NewScanner(os.Stdin)
for input.Scan() {
line := input.Text()
return line, nil
}

return strings.TrimSuffix(line, "\n"), nil
return "", nil
}

// New returns a prompt closure when executed asks for
Expand Down

0 comments on commit 0c3937f

Please sign in to comment.