Skip to content

Commit

Permalink
feat: show query start time in progress spinner (#798)
Browse files Browse the repository at this point in the history
* feat: show query start time in progress spinner

Signed-off-by: Darren Murray <[email protected]>

* feat: include time range in query run spinner

Signed-off-by: Darren Murray <[email protected]>
  • Loading branch information
dmurray-lacework authored Jun 1, 2022
1 parent 93dbb2d commit 2179616
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions cli/cmd/lql.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,8 +428,13 @@ func runQueryByID(id string, args []api.ExecuteQueryArgument) (
error,
) {
cli.Log.Debugw("running query", "query", id)

cli.StartProgress(" Executing query...")
msg := "Executing query"
startTime, startErr := time.Parse(time.RFC3339, args[0].Value)
endTime, endErr := time.Parse(time.RFC3339, args[1].Value)
if startErr == nil && endErr == nil {
msg = fmt.Sprintf("%s in the time range %s - %s", msg, startTime.Format("2006-Jan-2 15:04:05 MST"), endTime.Format("2006-Jan-2 15:04:05 MST"))
}
cli.StartProgress(msg)
defer cli.StopProgress()

request := api.ExecuteQueryByIDRequest{
Expand All @@ -454,7 +459,13 @@ func runAdhocQuery(cmd *cobra.Command, args []api.ExecuteQueryArgument) (
return
}

cli.StartProgress(" Executing query...")
msg := "Executing query"
startTime, startErr := time.Parse(time.RFC3339, args[0].Value)
endTime, endErr := time.Parse(time.RFC3339, args[1].Value)
if startErr == nil && endErr == nil {
msg = fmt.Sprintf("%s in the time range %s - %s", msg, startTime.Format("2006-Jan-2 15:04:05 MST"), endTime.Format("2006-Jan-2 15:04:05 MST"))
}
cli.StartProgress(msg)
defer cli.StopProgress()

// execute query
Expand Down

0 comments on commit 2179616

Please sign in to comment.