Fix MySQL support and TUI auto-confirm mode
- Fix format detection to read database_type from .meta.json metadata file - Add ensureMySQLDatabaseExists() for MySQL/MariaDB database creation - Route database creation to correct implementation based on db type - Add TUI auto-forward in auto-confirm mode (no input required for debugging) - All TUI components now exit automatically when --auto-confirm is set - Fix status view to skip loading in auto-confirm mode
This commit is contained in:
@@ -37,12 +37,21 @@ func NewStatusView(cfg *config.Config, log logger.Logger, parent tea.Model) Stat
|
||||
}
|
||||
|
||||
func (m StatusViewModel) Init() tea.Cmd {
|
||||
// Auto-forward in auto-confirm mode - skip status check
|
||||
if m.config.TUIAutoConfirm {
|
||||
return func() tea.Msg {
|
||||
return statusAutoQuitMsg{}
|
||||
}
|
||||
}
|
||||
return tea.Batch(
|
||||
fetchStatus(m.config, m.logger),
|
||||
tickCmd(),
|
||||
)
|
||||
}
|
||||
|
||||
// statusAutoQuitMsg triggers automatic quit
|
||||
type statusAutoQuitMsg struct{}
|
||||
|
||||
type tickMsg time.Time
|
||||
|
||||
func tickCmd() tea.Cmd {
|
||||
@@ -109,6 +118,9 @@ func fetchStatus(cfg *config.Config, log logger.Logger) tea.Cmd {
|
||||
|
||||
func (m StatusViewModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
switch msg := msg.(type) {
|
||||
case statusAutoQuitMsg:
|
||||
return m.parent, tea.Quit
|
||||
|
||||
case tickMsg:
|
||||
if m.loading {
|
||||
return m, tickCmd()
|
||||
@@ -126,6 +138,10 @@ func (m StatusViewModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
m.dbVersion = msg.dbVersion
|
||||
}
|
||||
m.connected = msg.connected
|
||||
// Auto-forward in auto-confirm mode after status loads
|
||||
if m.config.TUIAutoConfirm {
|
||||
return m.parent, tea.Quit
|
||||
}
|
||||
return m, nil
|
||||
|
||||
case tea.KeyMsg:
|
||||
|
||||
Reference in New Issue
Block a user