26 lines
393 B
Go
26 lines
393 B
Go
|
package util
|
||
|
|
||
|
import (
|
||
|
"bufio"
|
||
|
"fmt"
|
||
|
"os"
|
||
|
"strings"
|
||
|
)
|
||
|
|
||
|
func InputTerminal(name string) string {
|
||
|
|
||
|
fmt.Print(name + ": ")
|
||
|
reader := bufio.NewReader(os.Stdin)
|
||
|
ret, _ := reader.ReadString('\n')
|
||
|
splitedSlice := strings.Split(ret, " ")
|
||
|
|
||
|
if len(splitedSlice) == 1 {
|
||
|
splSlice2 := strings.Split(splitedSlice[0], "\n")
|
||
|
ret = splSlice2[0]
|
||
|
} else {
|
||
|
ret = splitedSlice[0]
|
||
|
}
|
||
|
|
||
|
return ret
|
||
|
}
|