-
|
Hello! Thanks for this awesome library. I’m new to Go and building a CLI with Bubbletea that launches a command and exits. I’m using |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
Take a look at the following examples for executing a command, then eventually returning to the TUI:
With that being said, if the intention is to use bubbletea to invoke another tool, and not returning back to the TUI, you can use func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
if acquiredNeededExecConfig {
m.yourExecConfig = [...]
return m, tea.Quit
}
}and in your main or similar: func main() {
finalModel, err := tea.NewProgram(initialModel())
if err != nil {
panic(err)
}
// use finalModel.yourExecConfig to exec the follow-up tool. because tea.Quit was used,
// the terminal has already been released, and should allow normal operations now.
} |
Beta Was this translation helpful? Give feedback.
-
|
Thanks a lot ! I've used |
Beta Was this translation helpful? Give feedback.
Take a look at the following examples for executing a command, then eventually returning to the TUI:
With that being said, if the intention is to use bubbletea to invoke another tool, and not returning back to the TUI, you can use
Program.ReleaseTerminal(from a goroutine or similar), though it may be better to use thetea.Quitcommand to exit from the model, so you don't have to do async operations to be able to callProgram.ReleaseTerminal.Run()returns the final model, so you could do something like this (…