diff options
| author | Paul Buetow <paul@buetow.org> | 2024-07-28 22:44:03 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2024-07-28 22:44:03 +0300 |
| commit | 8072daab7a5221842cf823d9b314deb49b9ba6ff (patch) | |
| tree | df82e769da205811d4347ff8e05527df58fdea74 /internal/client | |
| parent | f36f21e1f1610b76caecbfab844f0462a9ba040c (diff) | |
rename entry to ent
Diffstat (limited to 'internal/client')
| -rw-r--r-- | internal/client/tui/compose.go | 1 | ||||
| -rw-r--r-- | internal/client/tui/tui.go | 22 |
2 files changed, 16 insertions, 7 deletions
diff --git a/internal/client/tui/compose.go b/internal/client/tui/compose.go index 20f74f1..3148b2a 100644 --- a/internal/client/tui/compose.go +++ b/internal/client/tui/compose.go @@ -11,7 +11,6 @@ import ( ) func composeAction(conf config.ClientConfig, queue bool) tea.Cmd { - err := ensureDirectoryExists(conf.DataDir) composeFile := fmt.Sprintf("%s/%s", conf.DataDir, conf.ComposeFile) diff --git a/internal/client/tui/tui.go b/internal/client/tui/tui.go index 298b890..8d4c176 100644 --- a/internal/client/tui/tui.go +++ b/internal/client/tui/tui.go @@ -43,13 +43,14 @@ type model struct { } const ( - composeNewPostCursor = iota - submitPostCursor + cursorCompose = iota + cursorSubmit + cursorComposeAndSubmit ) func initModel(conf config.ClientConfig) model { return model{ - choices: []string{"Compose post", "Submit post"}, + choices: []string{"Compose post", "Submit post", "Compose & submit post"}, ctx: context.Background(), conf: conf, } @@ -73,11 +74,20 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { } case "enter": switch m.cursor { - case composeNewPostCursor: + case cursorCompose: return m, composeAction(m.conf, false) - case submitPostCursor: + case cursorSubmit: return m, submitAction(m.ctx, m.conf) + case cursorComposeAndSubmit: + // TODO: Find out correct way how to chain two tea.Cmd's?? + panic("not yet implemented") } + case "1": + return m, composeAction(m.conf, false) + case "2": + return m, submitAction(m.ctx, m.conf) + case "3": + panic("not yet implemented") case "a": m.altscreenActive = !m.altscreenActive @@ -111,7 +121,7 @@ func (m model) View() string { cursor = "==>" } - s += fmt.Sprintf("%s %s\n", cursor, choice) + s += fmt.Sprintf("%s %d. %s\n", cursor, i+1, choice) } if m.err != nil { |
