2022-07-17 08:42:12 +00:00
package agent
import (
"fmt"
2025-07-23 08:54:27 +00:00
tea "github.com/charmbracelet/bubbletea"
"github.com/kairos-io/kairos-sdk/types"
2023-08-03 17:49:09 +00:00
"os"
2022-07-17 08:42:12 +00:00
2023-03-18 09:27:18 +00:00
"github.com/kairos-io/kairos-sdk/utils"
2022-07-17 08:42:12 +00:00
)
2025-07-23 08:54:27 +00:00
// InteractiveInstall starts the interactive installation process.
// The function signature was updated to replace the `debug` parameter with a `logger` parameter (`l types.KairosLogger`).
// - `spawnShell`: If true, spawns a shell after the installation process.
// - `source`: The source of the installation. (Consider reviewing its necessity as noted in the TODO comment.)
// - `l`: A logger instance for logging messages during the installation process.
func InteractiveInstall ( spawnShell bool , source string , logger types . KairosLogger ) error {
var err error
// Set a default window size
p := tea . NewProgram ( InitialModel ( & logger , source ) , tea . WithAltScreen ( ) )
if _ , err := p . Run ( ) ; err != nil {
fmt . Printf ( "Error: %v" , err )
os . Exit ( 1 )
}
//TODO: This will always exit and return I think, so the below is useless? Unless we want to hijack the TTY in which case we should do something here for that
2022-07-17 08:42:12 +00:00
if spawnShell {
return utils . Shell ( ) . Run ( )
}
return err
}