mirror of
https://github.com/docker/compose.git
synced 2026-05-13 13:58:02 +00:00
fix: respect default value in prompt when input is empty
Signed-off-by: L. Jiang <l.jiang.1024@gmail.com>
This commit is contained in:
parent
85d6770b7f
commit
00c2c4970e
1 changed files with 3 additions and 0 deletions
|
|
@ -98,5 +98,8 @@ func (u Pipe) Confirm(message string, defaultValue bool) (bool, error) {
|
|||
_, _ = fmt.Fprint(u.stdout, message)
|
||||
var answer string
|
||||
_, _ = fmt.Fscanln(u.stdin, &answer)
|
||||
if answer == "" {
|
||||
return defaultValue, nil
|
||||
}
|
||||
return utils.StringToBool(answer), nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue