Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
kaidaguerre committed Dec 5, 2024
1 parent 5c4fe97 commit 9b5f4de
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
11 changes: 4 additions & 7 deletions cmd/collect.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ package cmd
import (
"errors"
"fmt"
"strings"

"golang.org/x/exp/maps"
"strings"

"github.com/danwakefield/fnmatch"
"github.com/spf13/cobra"
Expand All @@ -16,8 +15,6 @@ import (
"github.com/turbot/pipe-fittings/error_helpers"
"github.com/turbot/tailpipe/internal/collector"
"github.com/turbot/tailpipe/internal/config"
"golang.org/x/exp/maps"
"strings"
)

// NOTE: the hard coded config that was previously defined here has been moved to hcl in the file tailpipe/internal/parse/test_data/configs/resources.tpc
Expand Down Expand Up @@ -96,11 +93,11 @@ func runCollectCmd(cmd *cobra.Command, args []string) {
}

if err == nil {
fmt.Println(collectStatus)
fmt.Println(collectStatus) //nolint:forbidigo // ui output
if compactStatus != "" {
fmt.Println(compactStatus)
fmt.Println(compactStatus) //nolint:forbidigo // ui output
}
fmt.Println(collectTiming)
fmt.Println(collectTiming) //nolint:forbidigo //ui output
}
}

Expand Down
10 changes: 5 additions & 5 deletions internal/collector/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,18 +263,18 @@ func (c *Collector) WaitForCompletion(ctx context.Context) {
}

func (c *Collector) StatusString() string {
// TODO K we need to test multiple executions https://github.com/turbot/tailpipe/issues/71
var str strings.Builder
str.WriteString("Collection complete\n")
str.WriteString("Collection complete.\n\n")
str.WriteString(c.status.String())
str.WriteString("\n")
// print out the execution status
for _, e := range c.executions {
switch e.state {
case ExecutionState_ERROR:
if e.state == ExecutionState_ERROR {
str.WriteString(fmt.Sprintf("Execution %s failed: %s\n", e.id, e.error))
case ExecutionState_COMPLETE:
str.WriteString(fmt.Sprintf("Execution %s complete\n", e.id))
}
//case ExecutionState_COMPLETE:
// str.WriteString(fmt.Sprintf("Execution %s complete\n", e.id))
}
return str.String()
}
Expand Down
2 changes: 1 addition & 1 deletion internal/collector/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ func (s *status) setChunksWritten(chunksWritten int32) {
}

func (s *status) String() string {
return fmt.Sprintf("artifacts discovered: %d, artifacts downloaded: %d, artifacts extracted: %d, rows enriched: %d, rows converted: %d, errors: %d", s.ArtifactsDiscovered, s.ArtifactsDownloaded, s.ArtifactsExtracted, s.RowsEnriched, s.RowsConverted, s.Errors)
return fmt.Sprintf("Artifacts discovered: %d. Artifacts downloaded: %d. Artifacts extracted: %d. Rows enriched: %d. Rows converted: %d. Errors: %d.", s.ArtifactsDiscovered, s.ArtifactsDownloaded, s.ArtifactsExtracted, s.RowsEnriched, s.RowsConverted, s.Errors)
}

0 comments on commit 9b5f4de

Please sign in to comment.