diff --git a/cmd/slackdump/internal/apiconfig/check.go b/cmd/slackdump/internal/apiconfig/check.go index 438e226b..d3302252 100644 --- a/cmd/slackdump/internal/apiconfig/check.go +++ b/cmd/slackdump/internal/apiconfig/check.go @@ -6,7 +6,7 @@ import ( "fmt" "github.com/rusq/slackdump/v3/cmd/slackdump/internal/golang/base" - "github.com/rusq/slackdump/v3/internal/ui" + "github.com/rusq/slackdump/v3/cmd/slackdump/internal/ui" ) var CmdConfigCheck = &base.Command{ diff --git a/cmd/slackdump/internal/apiconfig/new.go b/cmd/slackdump/internal/apiconfig/new.go index 0d338a6b..b304f711 100644 --- a/cmd/slackdump/internal/apiconfig/new.go +++ b/cmd/slackdump/internal/apiconfig/new.go @@ -10,8 +10,8 @@ import ( "github.com/rusq/slackdump/v3/cmd/slackdump/internal/cfg" "github.com/rusq/slackdump/v3/cmd/slackdump/internal/golang/base" + "github.com/rusq/slackdump/v3/cmd/slackdump/internal/ui" "github.com/rusq/slackdump/v3/internal/network" - "github.com/rusq/slackdump/v3/internal/ui" ) var CmdConfigNew = &base.Command{ diff --git a/cmd/slackdump/internal/diag/uninstall.go b/cmd/slackdump/internal/diag/uninstall.go index 6b192b6a..a8a8f42c 100644 --- a/cmd/slackdump/internal/diag/uninstall.go +++ b/cmd/slackdump/internal/diag/uninstall.go @@ -9,7 +9,7 @@ import ( "github.com/rusq/slackdump/v3/cmd/slackdump/internal/cfg" "github.com/rusq/slackdump/v3/cmd/slackdump/internal/diag/info" "github.com/rusq/slackdump/v3/cmd/slackdump/internal/golang/base" - "github.com/rusq/slackdump/v3/internal/ui" + "github.com/rusq/slackdump/v3/cmd/slackdump/internal/ui" "github.com/rusq/slackdump/v3/logger" ) diff --git a/cmd/slackdump/internal/emoji/wizard.go b/cmd/slackdump/internal/emoji/wizard.go index b45ec585..31723eb3 100644 --- a/cmd/slackdump/internal/emoji/wizard.go +++ b/cmd/slackdump/internal/emoji/wizard.go @@ -6,7 +6,7 @@ import ( "github.com/rusq/slackdump/v3/cmd/slackdump/internal/cfg" "github.com/rusq/slackdump/v3/cmd/slackdump/internal/golang/base" - "github.com/rusq/slackdump/v3/internal/ui" + "github.com/rusq/slackdump/v3/cmd/slackdump/internal/ui" ) func wizard(ctx context.Context, cmd *base.Command, args []string) error { diff --git a/internal/ui/ask/ask.go b/cmd/slackdump/internal/ui/ask/ask.go similarity index 100% rename from internal/ui/ask/ask.go rename to cmd/slackdump/internal/ui/ask/ask.go diff --git a/internal/ui/ask/dump.go b/cmd/slackdump/internal/ui/ask/dump.go similarity index 94% rename from internal/ui/ask/dump.go rename to cmd/slackdump/internal/ui/ask/dump.go index 3bf54459..9d83598b 100644 --- a/internal/ui/ask/dump.go +++ b/cmd/slackdump/internal/ui/ask/dump.go @@ -4,8 +4,8 @@ import ( "fmt" "strings" + "github.com/rusq/slackdump/v3/cmd/slackdump/internal/ui" "github.com/rusq/slackdump/v3/internal/structures" - "github.com/rusq/slackdump/v3/internal/ui" ) // ConversationList asks the user for the list of conversations to dump or diff --git a/internal/ui/ask/export.go b/cmd/slackdump/internal/ui/ask/export.go similarity index 100% rename from internal/ui/ask/export.go rename to cmd/slackdump/internal/ui/ask/export.go diff --git a/internal/ui/ask/timerange.go b/cmd/slackdump/internal/ui/ask/timerange.go similarity index 93% rename from internal/ui/ask/timerange.go rename to cmd/slackdump/internal/ui/ask/timerange.go index 70718173..c4f58dfd 100644 --- a/internal/ui/ask/timerange.go +++ b/cmd/slackdump/internal/ui/ask/timerange.go @@ -4,7 +4,7 @@ import ( "errors" "time" - "github.com/rusq/slackdump/v3/internal/ui" + "github.com/rusq/slackdump/v3/cmd/slackdump/internal/ui" ) func MaybeTimeRange() (oldest, latest time.Time, err error) { diff --git a/internal/ui/confirm.go b/cmd/slackdump/internal/ui/confirm.go similarity index 100% rename from internal/ui/confirm.go rename to cmd/slackdump/internal/ui/confirm.go diff --git a/internal/ui/filesystem.go b/cmd/slackdump/internal/ui/filesystem.go similarity index 100% rename from internal/ui/filesystem.go rename to cmd/slackdump/internal/ui/filesystem.go diff --git a/internal/ui/filesystem_test.go b/cmd/slackdump/internal/ui/filesystem_test.go similarity index 100% rename from internal/ui/filesystem_test.go rename to cmd/slackdump/internal/ui/filesystem_test.go diff --git a/internal/ui/input.go b/cmd/slackdump/internal/ui/input.go similarity index 100% rename from internal/ui/input.go rename to cmd/slackdump/internal/ui/input.go diff --git a/internal/ui/time.go b/cmd/slackdump/internal/ui/time.go similarity index 100% rename from internal/ui/time.go rename to cmd/slackdump/internal/ui/time.go diff --git a/internal/ui/time_test.go b/cmd/slackdump/internal/ui/time_test.go similarity index 100% rename from internal/ui/time_test.go rename to cmd/slackdump/internal/ui/time_test.go diff --git a/internal/ui/ui.go b/cmd/slackdump/internal/ui/ui.go similarity index 100% rename from internal/ui/ui.go rename to cmd/slackdump/internal/ui/ui.go diff --git a/internal/ui/ui_test.go b/cmd/slackdump/internal/ui/ui_test.go similarity index 100% rename from internal/ui/ui_test.go rename to cmd/slackdump/internal/ui/ui_test.go diff --git a/internal/ui/validators.go b/cmd/slackdump/internal/ui/validators.go similarity index 100% rename from internal/ui/validators.go rename to cmd/slackdump/internal/ui/validators.go diff --git a/cmd/slackdump/internal/wizard/model.go b/cmd/slackdump/internal/wizard/model.go index 62df4700..4f10ed1a 100644 --- a/cmd/slackdump/internal/wizard/model.go +++ b/cmd/slackdump/internal/wizard/model.go @@ -10,8 +10,9 @@ import ( ) type model struct { - form *huh.Form - val string + form *huh.Form + val string + finished bool } const kSelection = "selection" // selection key @@ -47,6 +48,7 @@ func (m *model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { case tea.KeyMsg: switch msg.String() { case "esc", "ctrl+c", "q": + m.finished = true return m, tea.Quit } } @@ -67,6 +69,9 @@ func (m *model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { } func (m *model) View() string { + if m.finished { + return "" + } return m.form.View() } diff --git a/cmd/slackdump/internal/wizard/wizard.go b/cmd/slackdump/internal/wizard/wizard.go index a60fddfd..6a21634d 100644 --- a/cmd/slackdump/internal/wizard/wizard.go +++ b/cmd/slackdump/internal/wizard/wizard.go @@ -136,6 +136,9 @@ var ( ) func run(m *menu, choice string, onMatch func(cmd *base.Command) error) error { + if choice == "" { + return errBack + } for _, mi := range m.items { if choice != mi.Name { continue