diff options
| author | Paul Buetow <paul@buetow.org> | 2024-11-22 23:25:46 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2024-11-22 23:25:46 +0200 |
| commit | faf7569ab307eff706e4ccf2ed92eec5c93f67eb (patch) | |
| tree | fa81064795ec6f742c5fc3eab314c83abdd2e5de /internal/prompt/file.go | |
| parent | b6f1f3f602df0368ac7ecec211e6c95b93a1c53c (diff) | |
implement random other
Diffstat (limited to 'internal/prompt/file.go')
| -rw-r--r-- | internal/prompt/file.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/internal/prompt/file.go b/internal/prompt/file.go index 9668aed..2a23591 100644 --- a/internal/prompt/file.go +++ b/internal/prompt/file.go @@ -13,11 +13,11 @@ import ( ) var ( - ErrAborted = errors.New("aborted") - ErrDeleted = errors.New("deleted") + ErrAborted = errors.New("aborted") + ErrDeleted = errors.New("deleted") + ErrRamdomOther = errors.New("randomOther") ) -// TODO: Add option to randomly select another entry when no selected? func FileAction(question, content, filePath string) (string, error) { colour.Info2f(filePath + ":") fmt.Print("\n") @@ -26,7 +26,7 @@ func FileAction(question, content, filePath string) (string, error) { reader := bufio.NewReader(os.Stdin) for { - colour.Ackf("%s (y=yes/n=no/e=edit/d=delete):", question) + colour.Ackf("%s (y=yes/n=no/e=edit/d=delete/r=random other):", question) input, err := reader.ReadString('\n') if err != nil { fmt.Println("Error reading input:", err) @@ -51,6 +51,8 @@ func FileAction(question, content, filePath string) (string, error) { return content, err } return content, fmt.Errorf("%w %s", ErrDeleted, filePath) + case "r", "random", "random other": + return content, fmt.Errorf("%w %s", ErrRamdomOther, filePath) default: fmt.Println("Please enter 'y' or 'n' or 'e' or 'd'.") } |
