mirror of
https://github.com/shouptech/tempgopher.git
synced 2026-02-03 08:39:43 +00:00
Refactor PromptForConfiguration to accept io.Reader
This commit is contained in:
parent
281af2b255
commit
14b5cc4a8b
1 changed files with 4 additions and 3 deletions
7
cli.go
7
cli.go
|
|
@ -3,6 +3,7 @@ package main
|
|||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
|
@ -40,8 +41,8 @@ func ParsePort(addr string) (uint16, error) {
|
|||
}
|
||||
|
||||
// PromptForConfiguration walks a user through configuration
|
||||
func PromptForConfiguration() Config {
|
||||
reader := bufio.NewReader(os.Stdin)
|
||||
func PromptForConfiguration(in io.Reader) Config {
|
||||
reader := bufio.NewReader(in)
|
||||
|
||||
var config Config
|
||||
|
||||
|
|
@ -243,7 +244,7 @@ func ConfigCLI(path string) {
|
|||
os.Exit(1)
|
||||
}
|
||||
|
||||
config := PromptForConfiguration()
|
||||
config := PromptForConfiguration(os.Stdin)
|
||||
|
||||
SaveConfig(path, config)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue