bug fix
This commit is contained in:
parent
538445a201
commit
95503ec65a
8
io.go
8
io.go
@ -54,7 +54,7 @@ func messageBox(hint string, defaultVal string) InputMsg {
|
|||||||
if len(strValue) == 0 {
|
if len(strValue) == 0 {
|
||||||
strValue = defaultVal
|
strValue = defaultVal
|
||||||
}
|
}
|
||||||
return InputMsg{msg: "", err: err}
|
return InputMsg{msg: strValue, err: err}
|
||||||
}
|
}
|
||||||
if b == 0x08 || b == 0x7F {
|
if b == 0x08 || b == 0x7F {
|
||||||
if len(ioBuf) > 0 {
|
if len(ioBuf) > 0 {
|
||||||
@ -101,7 +101,7 @@ func passwd(hint string, defaultVal string, mask string) InputMsg {
|
|||||||
if len(strValue) == 0 {
|
if len(strValue) == 0 {
|
||||||
strValue = defaultVal
|
strValue = defaultVal
|
||||||
}
|
}
|
||||||
return InputMsg{msg: "", err: err}
|
return InputMsg{msg: strValue, err: err}
|
||||||
}
|
}
|
||||||
if b == 0x08 || b == 0x7F {
|
if b == 0x08 || b == 0x7F {
|
||||||
if len(ioBuf) > 0 {
|
if len(ioBuf) > 0 {
|
||||||
@ -131,13 +131,13 @@ func MessageBox(hint string, defaultVal string) InputMsg {
|
|||||||
inputReader := bufio.NewReader(os.Stdin)
|
inputReader := bufio.NewReader(os.Stdin)
|
||||||
str, err := inputReader.ReadString('\n')
|
str, err := inputReader.ReadString('\n')
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return InputMsg{msg: "", err: err}
|
return InputMsg{msg: str, err: err}
|
||||||
}
|
}
|
||||||
str = strings.TrimSpace(str)
|
str = strings.TrimSpace(str)
|
||||||
if len(str) == 0 {
|
if len(str) == 0 {
|
||||||
str = defaultVal
|
str = defaultVal
|
||||||
}
|
}
|
||||||
return InputMsg{msg: "", err: err}
|
return InputMsg{msg: str, err: err}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (im InputMsg) IgnoreSliceParseError(i bool) InputMsg {
|
func (im InputMsg) IgnoreSliceParseError(i bool) InputMsg {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user