diff options
| author | Paul Buetow <paul@buetow.org> | 2025-02-08 22:49:31 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-02-08 22:49:31 +0200 |
| commit | 8fbc04cfdf939ee2a0b76cc267b31e01038aa955 (patch) | |
| tree | 750f832b2db27f97d8487b8a06676814e0e54229 /internal/prompt | |
| parent | 316ef97b655e4837dbce4af3747003ed924b5874 (diff) | |
more use of tables
Diffstat (limited to 'internal/prompt')
| -rw-r--r-- | internal/prompt/file.go | 12 | ||||
| -rw-r--r-- | internal/prompt/prompt.go | 12 |
2 files changed, 18 insertions, 6 deletions
diff --git a/internal/prompt/file.go b/internal/prompt/file.go index 11e32a2..f692b77 100644 --- a/internal/prompt/file.go +++ b/internal/prompt/file.go @@ -10,6 +10,7 @@ import ( "codeberg.org/snonux/gos/internal/colour" "codeberg.org/snonux/gos/internal/oi" + "codeberg.org/snonux/gos/internal/table" ) var ( @@ -20,8 +21,12 @@ var ( ) func FileAction(question, content, filePath string, includeRandomOption ...bool) (string, error) { - colour.Info2fln("%s:", filePath) - colour.Info2fln("%s", content) + table.New(). + WithBaseColor(colour.AttentionCol). + WithHeaderColor(colour.AckCol). + Header(question). + TextBox(content). + MustRender() reader := bufio.NewReader(os.Stdin) includeRandom := len(includeRandomOption) > 0 && includeRandomOption[0] == RandomOption @@ -31,7 +36,8 @@ func FileAction(question, content, filePath string, includeRandomOption ...bool) } for { - colour.Ackf("%s (y=yes/n=no/e=edit/d=delete%s):", question, randomOption) + fmt.Print(" ") + colour.Ackf("(y=yes/n=no/e=edit/d=delete%s):", randomOption) input, err := reader.ReadString('\n') if err != nil { return "", fmt.Errorf("error reading input: %w", err) diff --git a/internal/prompt/prompt.go b/internal/prompt/prompt.go index 646888f..8dfc437 100644 --- a/internal/prompt/prompt.go +++ b/internal/prompt/prompt.go @@ -6,16 +6,22 @@ import ( "os" "codeberg.org/snonux/gos/internal/colour" + "codeberg.org/snonux/gos/internal/table" ) func Acknowledge(messages ...string) error { if len(messages) > 1 { for _, content := range messages[1:] { - colour.Info2fln("%s", content) - fmt.Print("\n") + table.New(). + WithBaseColor(colour.AttentionCol). + WithHeaderColor(colour.AckCol). + Header(messages[0]). + TextBox(content). + MustRender() } } - colour.Ackf(messages[0] + " (press enter to acknowlege)") + fmt.Printf(" ") + colour.Ackf("(press enter to acknowlege)") reader := bufio.NewReader(os.Stdin) if _, err := reader.ReadString('\n'); err != nil { return err |
