summaryrefslogtreecommitdiff
path: root/internal/io/prompt
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2021-10-09 21:10:29 +0300
committerPaul Buetow <paul@buetow.org>2021-10-10 13:36:41 +0300
commit97747ea0f3178f7f5890512d483fdccaa82846b0 (patch)
tree9ff1335ca26afc90e55fd6de416457e252d75a35 /internal/io/prompt
parent7a7169791a64190e1002e38bc9c04ad0d5c1ce1f (diff)
vetting and linting and some code restyling
Diffstat (limited to 'internal/io/prompt')
-rw-r--r--internal/io/prompt/prompt.go7
1 files changed, 2 insertions, 5 deletions
diff --git a/internal/io/prompt/prompt.go b/internal/io/prompt/prompt.go
index 7c3cdb5..e82132d 100644
--- a/internal/io/prompt/prompt.go
+++ b/internal/io/prompt/prompt.go
@@ -19,7 +19,8 @@ type Answer struct {
Callback func()
// Runs after Callback and after logging resumes
EndCallback func()
- AskAgain bool
+ // AskAgain can be used to not to ask again about the question.
+ AskAgain bool
}
// Prompt used for interactive user input.
@@ -30,7 +31,6 @@ type Prompt struct {
func (p *Prompt) askString() string {
var sb strings.Builder
-
sb.WriteString(p.question)
sb.WriteString("? (")
@@ -41,7 +41,6 @@ func (p *Prompt) askString() string {
sb.WriteString(strings.Join(ax, ","))
sb.WriteString("): ")
-
return sb.String()
}
@@ -68,7 +67,6 @@ func (p *Prompt) Ask() {
if a.Callback != nil {
a.Callback()
}
-
if !a.AskAgain {
dlog.Common.Resume()
if a.EndCallback != nil {
@@ -90,6 +88,5 @@ func (p *Prompt) answer(answerStr string) (*Answer, bool) {
default:
}
}
-
return nil, false
}