From 0fa5420bfaed55ecbb43e98a18138aed7f658660 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Mon, 1 Jul 2024 11:13:41 +0300 Subject: display error message in TUI --- internal/client/tui/submit.go | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'internal/client/tui/submit.go') diff --git a/internal/client/tui/submit.go b/internal/client/tui/submit.go index 15b7826..5507000 100644 --- a/internal/client/tui/submit.go +++ b/internal/client/tui/submit.go @@ -3,30 +3,25 @@ package tui import ( "fmt" + "codeberg.org/snonux/gos/internal/config/client" config "codeberg.org/snonux/gos/internal/config/client" tea "github.com/charmbracelet/bubbletea" ) func submitAction(conf config.ClientConfig) tea.Cmd { - // The composed file is now the file to be submitted. - //submitFile := fmt.Sprintf("%s/%s", conf.DataDir, conf.ComposeFile) + composeFile := fmt.Sprintf("%s/%s", conf.DataDir, conf.ComposeFile) - /* - c := &http.Client{ - Timeout: 10 * time.Second, - } - res, err := c.Get(url) - if err != nil { - return sub{err} - } - defer res.Body.Close() - */ + return submitMessage(conf, composeFile, func() error { + // This is the callback to call + return nil + }) +} +func submitMessage(conf client.ClientConfig, filePath string, callback func() error) tea.Cmd { return func() tea.Msg { - err := fmt.Errorf("this is a test errorrrrrr!") return finishedMsg{ - err: err, + callback: callback, + err: fmt.Errorf("This is a sample error"), } } - } -- cgit v1.2.3