29 lines
534 B
Go
29 lines
534 B
Go
package tui
|
|
|
|
import (
|
|
"os/exec"
|
|
|
|
tea "charm.land/bubbletea/v2"
|
|
)
|
|
|
|
// --- Messages ---
|
|
|
|
type DockerCheckedMsg struct{ Installed bool }
|
|
type DockerInstalledMsg struct{ Err error }
|
|
|
|
// --- Commands ---
|
|
|
|
func CheckDockerCmd() tea.Cmd {
|
|
return func() tea.Msg {
|
|
_, err := exec.LookPath("docker")
|
|
return DockerCheckedMsg{Installed: err == nil}
|
|
}
|
|
}
|
|
|
|
func InstallDockerCmd() tea.Cmd {
|
|
return func() tea.Msg {
|
|
err := exec.Command("sh", "-c", "curl -fsSL https://get.docker.com | sh").Run()
|
|
return DockerInstalledMsg{Err: err}
|
|
}
|
|
}
|