mirror of
https://github.com/turbot/steampipe.git
synced 2026-02-22 23:00:16 -05:00
27 lines
831 B
Go
27 lines
831 B
Go
package interactive
|
|
|
|
import (
|
|
"github.com/turbot/steampipe/constants"
|
|
"github.com/turbot/steampipe/db/db_common"
|
|
"github.com/turbot/steampipe/db/db_local"
|
|
"github.com/turbot/steampipe/query/queryresult"
|
|
"github.com/turbot/steampipe/utils"
|
|
)
|
|
|
|
// RunInteractivePrompt starts the interactive query prompt
|
|
func RunInteractivePrompt(initChan *chan *db_common.QueryInitData) (*queryresult.ResultStreamer, error) {
|
|
resultsStreamer := queryresult.NewResultStreamer()
|
|
|
|
interactiveClient, err := newInteractiveClient(initChan, resultsStreamer)
|
|
if err != nil {
|
|
utils.ShowErrorWithMessage(err, "interactive client failed to initialize")
|
|
db_local.ShutdownService(constants.InvokerQuery)
|
|
return nil, err
|
|
}
|
|
|
|
// start the interactive prompt in a go routine
|
|
go interactiveClient.InteractivePrompt()
|
|
|
|
return resultsStreamer, nil
|
|
}
|