diff options
| author | Paul Buetow <paul@buetow.org> | 2024-10-27 17:19:34 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2024-10-27 17:19:34 +0200 |
| commit | 3d8935e6456bcfe462bd7735615e9009ef5ff7c6 (patch) | |
| tree | 342ba25a782d72490b9fa5931685e818a79a2aaf /internal/prompt | |
| parent | e17fa34a36835930a0ec1678e086f450cb9aa620 (diff) | |
can ask before queueing
Diffstat (limited to 'internal/prompt')
| -rw-r--r-- | internal/prompt/prompt.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/internal/prompt/prompt.go b/internal/prompt/prompt.go index fb5b870..e9c5e72 100644 --- a/internal/prompt/prompt.go +++ b/internal/prompt/prompt.go @@ -14,10 +14,13 @@ import ( var ( ErrAborted = errors.New("aborted") ErrEditContent = errors.New("edit content") + ErrDeleteFile = errors.New("delete file") info = color.New(color.FgCyan, color.BgBlue, color.Bold).PrintfFunc() ack = color.New(color.FgHiBlack, color.BgHiGreen, color.Bold).PrintfFunc() ) +// TODO: Refactor this prompt, including all operations done on the file, like abort, edit, remove, etc. +// TODO: And also don't use error for control flow. func DoYouWantThis(question, content string) error { info(content) fmt.Print("\n") @@ -39,7 +42,7 @@ func whatNow(question string) error { reader := bufio.NewReader(os.Stdin) for { - ack("%s (y=yes/n=no/e=edit):", question) + ack("%s (y=yes/n=no/e=edit/d=delete):", question) input, err := reader.ReadString('\n') if err != nil { fmt.Println("Error reading input:", err) @@ -53,8 +56,11 @@ func whatNow(question string) error { return ErrAborted case "e", "edit": return ErrEditContent + case "d", "delete": + // TODO: Implement + return ErrDeleteFile default: - fmt.Println("Please enter 'y' or 'n' or 'e'.") + fmt.Println("Please enter 'y' or 'n' or 'e' or 'd'.") } } } |
