This commit is contained in:
kai
2024-09-17 10:16:18 +01:00
committed by Puskar Basu
parent 6efd1fd6b2
commit 1804741bbd
19 changed files with 37 additions and 33 deletions

View File

@@ -5,8 +5,6 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/turbot/pipe-fittings/contexthelpers"
"github.com/turbot/pipe-fittings/querydisplay"
"strings"
"sync"
"time"
@@ -16,9 +14,11 @@ import (
"github.com/spf13/viper"
"github.com/turbot/go-kit/helpers"
pconstants "github.com/turbot/pipe-fittings/constants"
"github.com/turbot/pipe-fittings/contexthelpers"
perror_helpers "github.com/turbot/pipe-fittings/error_helpers"
putils "github.com/turbot/pipe-fittings/ociinstaller"
pplugin "github.com/turbot/pipe-fittings/plugin"
"github.com/turbot/pipe-fittings/querydisplay"
"github.com/turbot/pipe-fittings/utils"
"github.com/turbot/pipe-fittings/versionfile"
"github.com/turbot/steampipe-plugin-sdk/v5/sperr"

View File

@@ -4,7 +4,6 @@ import (
"bufio"
"context"
"fmt"
"github.com/turbot/pipe-fittings/contexthelpers"
"os"
"path"
"strings"
@@ -14,6 +13,7 @@ import (
"github.com/thediveo/enumflag/v2"
"github.com/turbot/go-kit/helpers"
pconstants "github.com/turbot/pipe-fittings/constants"
"github.com/turbot/pipe-fittings/contexthelpers"
"github.com/turbot/pipe-fittings/utils"
"github.com/turbot/steampipe-plugin-sdk/v5/sperr"
"github.com/turbot/steampipe/pkg/cmdconfig"

View File

@@ -4,7 +4,6 @@ import (
"context"
"errors"
"fmt"
"github.com/turbot/pipe-fittings/querydisplay"
"log"
"os"
"os/signal"
@@ -16,6 +15,7 @@ import (
"github.com/spf13/viper"
"github.com/turbot/go-kit/helpers"
pconstants "github.com/turbot/pipe-fittings/constants"
"github.com/turbot/pipe-fittings/querydisplay"
putils "github.com/turbot/pipe-fittings/utils"
"github.com/turbot/steampipe-plugin-sdk/v5/sperr"
"github.com/turbot/steampipe/pkg/cmdconfig"

View File

@@ -4,7 +4,6 @@ import (
"context"
"database/sql"
"fmt"
queryresult2 "github.com/turbot/pipe-fittings/queryresult"
"log"
"net/netip"
"strings"
@@ -16,6 +15,7 @@ import (
"github.com/spf13/viper"
"github.com/turbot/go-kit/helpers"
pconstants "github.com/turbot/pipe-fittings/constants"
pqueryresult "github.com/turbot/pipe-fittings/queryresult"
"github.com/turbot/pipe-fittings/utils"
"github.com/turbot/steampipe/pkg/constants"
"github.com/turbot/steampipe/pkg/db/db_common"
@@ -332,7 +332,7 @@ Loop:
}
}
func readRow(rows pgx.Rows, cols []*queryresult2.ColumnDef) ([]interface{}, error) {
func readRow(rows pgx.Rows, cols []*pqueryresult.ColumnDef) ([]interface{}, error) {
columnValues, err := rows.Values()
if err != nil {
return nil, error_helpers.WrapError(err)
@@ -340,7 +340,7 @@ func readRow(rows pgx.Rows, cols []*queryresult2.ColumnDef) ([]interface{}, erro
return populateRow(columnValues, cols)
}
func populateRow(columnValues []interface{}, cols []*queryresult2.ColumnDef) ([]interface{}, error) {
func populateRow(columnValues []interface{}, cols []*pqueryresult.ColumnDef) ([]interface{}, error) {
result := make([]interface{}, len(columnValues))
for i, columnValue := range columnValues {
if columnValue != nil {

View File

@@ -2,12 +2,12 @@ package db_client
import (
"fmt"
"github.com/turbot/pipe-fittings/queryresult"
"strconv"
"strings"
"github.com/jackc/pgx/v5"
"github.com/jackc/pgx/v5/pgconn"
"github.com/turbot/pipe-fittings/queryresult"
"github.com/turbot/pipe-fittings/utils"
)

View File

@@ -2,6 +2,7 @@ package db_common
import (
"context"
"github.com/jackc/pgx/v5/pgconn"
"github.com/jackc/pgx/v5/pgxpool"
pqueryresult "github.com/turbot/pipe-fittings/queryresult"

View File

@@ -2,9 +2,9 @@ package db_common
import (
"context"
"github.com/turbot/steampipe/pkg/query/queryresult"
"github.com/turbot/pipe-fittings/utils"
"github.com/turbot/steampipe/pkg/query/queryresult"
)
// ExecuteQuery executes a single query. If shutdownAfterCompletion is true, shutdown the client after completion

View File

@@ -4,8 +4,6 @@ import (
"context"
"errors"
"fmt"
"github.com/turbot/pipe-fittings/app_specific"
constants2 "github.com/turbot/pipe-fittings/constants"
"log"
"os"
"os/exec"
@@ -16,6 +14,8 @@ import (
psutils "github.com/shirou/gopsutil/process"
filehelpers "github.com/turbot/go-kit/files"
"github.com/turbot/go-kit/helpers"
"github.com/turbot/pipe-fittings/app_specific"
pconstants "github.com/turbot/pipe-fittings/constants"
putils "github.com/turbot/pipe-fittings/utils"
"github.com/turbot/steampipe/pkg/constants"
"github.com/turbot/steampipe/pkg/filepaths"
@@ -66,7 +66,7 @@ func EnsureDBInstalled(ctx context.Context) (err error) {
return err
}
if dbState != nil {
return fmt.Errorf("cannot install service - a previous version of the Steampipe service is still running. To stop running services, use %s ", constants2.Bold("steampipe service stop"))
return fmt.Errorf("cannot install service - a previous version of the Steampipe service is still running. To stop running services, use %s ", pconstants.Bold("steampipe service stop"))
}
log.Println("[TRACE] calling removeRunningInstanceInfo")
@@ -210,7 +210,7 @@ func prepareDb(ctx context.Context) error {
// get the message renderer from the context
// this allows the interactive client init to inject a custom renderer
messageRenderer := statushooks.MessageRendererFromContext(ctx)
messageRenderer("%s updated to %s.", constants2.Bold("steampipe-postgres-fdw"), constants2.Bold(constants.FdwVersion))
messageRenderer("%s updated to %s.", pconstants.Bold("steampipe-postgres-fdw"), pconstants.Bold(constants.FdwVersion))
}
if needsInit() {
@@ -247,7 +247,7 @@ func installFDW(ctx context.Context, firstSetup bool) (string, error) {
}
}()
}
statushooks.SetStatus(ctx, fmt.Sprintf("Download & install %s…", constants2.Bold("steampipe-postgres-fdw")))
statushooks.SetStatus(ctx, fmt.Sprintf("Download & install %s…", pconstants.Bold("steampipe-postgres-fdw")))
return ociinstaller.InstallFdw(ctx, filepaths.GetDatabaseLocation())
}

View File

@@ -2,13 +2,13 @@ package db_local
import (
"fmt"
"github.com/turbot/pipe-fittings/constants"
"log"
"os"
"strconv"
"strings"
filehelpers "github.com/turbot/go-kit/files"
"github.com/turbot/pipe-fittings/constants"
"github.com/turbot/pipe-fittings/utils"
"github.com/turbot/steampipe/pkg/filepaths"
)

View File

@@ -3,6 +3,7 @@ package error_helpers
import (
"errors"
"fmt"
"github.com/turbot/pipe-fittings/constants"
)

View File

@@ -5,7 +5,6 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/turbot/pipe-fittings/querydisplay"
"log"
"os"
"os/signal"
@@ -21,6 +20,7 @@ import (
"github.com/spf13/viper"
"github.com/turbot/go-kit/helpers"
pconstants "github.com/turbot/pipe-fittings/constants"
"github.com/turbot/pipe-fittings/querydisplay"
"github.com/turbot/pipe-fittings/utils"
"github.com/turbot/steampipe/pkg/cmdconfig"
"github.com/turbot/steampipe/pkg/connection_sync"

View File

@@ -3,11 +3,11 @@ package metaquery
import (
"context"
"fmt"
constants2 "github.com/turbot/pipe-fittings/constants"
"sort"
"strings"
"github.com/turbot/go-kit/helpers"
pconstants "github.com/turbot/pipe-fittings/constants"
"github.com/turbot/steampipe/pkg/constants"
)
@@ -27,7 +27,7 @@ func doHelp(_ context.Context, _ *HandlerInput) error {
fmt.Printf("Welcome to Steampipe shell.\n\nTo start, simply enter your SQL query at the prompt:\n\n select * from aws_iam_user\n\nCommon commands:\n\n%s\n\nAdvanced commands:\n\n%s\n\nDocumentation available at %s\n",
buildTable(commonCmdRows, true),
buildTable(advanceCmdRows, true),
constants2.Bold("https://steampipe.io/docs"))
pconstants.Bold("https://steampipe.io/docs"))
fmt.Println()
return nil
}

View File

@@ -3,14 +3,14 @@ package metaquery
import (
"context"
"fmt"
constants2 "github.com/turbot/pipe-fittings/constants"
"github.com/turbot/pipe-fittings/querydisplay"
"log"
"regexp"
"sort"
"strings"
"time"
pconstants "github.com/turbot/pipe-fittings/constants"
"github.com/turbot/pipe-fittings/querydisplay"
"github.com/turbot/steampipe-plugin-sdk/v5/sperr"
"github.com/turbot/steampipe/pkg/constants"
"github.com/turbot/steampipe/pkg/error_helpers"
@@ -110,7 +110,7 @@ func listTables(ctx context.Context, input *HandlerInput) error {
fmt.Printf(`
To get information about the columns in a table, run %s
`, constants2.Bold(".inspect {connection}.{table}"))
`, pconstants.Bold(".inspect {connection}.{table}"))
} else {
// could be one of connectionName and {string}*
arg := input.args()[0]
@@ -194,7 +194,7 @@ func listConnections(ctx context.Context, input *HandlerInput) error {
To get information about the tables in a connection, run %s
To get information about the columns in a table, run %s
`, constants2.Bold(".inspect {connection}"), constants2.Bold(".inspect {connection}.{table}"))
`, pconstants.Bold(".inspect {connection}"), pconstants.Bold(".inspect {connection}.{table}"))
return nil
}

View File

@@ -2,12 +2,12 @@ package metaquery
import (
"context"
"github.com/turbot/pipe-fittings/querydisplay"
"strings"
"github.com/spf13/viper"
"github.com/turbot/go-kit/helpers"
pconstants "github.com/turbot/pipe-fittings/constants"
"github.com/turbot/pipe-fittings/querydisplay"
"github.com/turbot/steampipe/pkg/constants"
)

View File

@@ -2,6 +2,7 @@ package interactive
import (
"context"
"github.com/turbot/steampipe/pkg/constants"
"github.com/turbot/steampipe/pkg/db/db_local"
"github.com/turbot/steampipe/pkg/error_helpers"

View File

@@ -3,6 +3,7 @@ package statushooks
import (
"context"
"fmt"
"github.com/turbot/pipe-fittings/contexthelpers"
)

View File

@@ -2,7 +2,6 @@ package statushooks
import (
"fmt"
"github.com/turbot/pipe-fittings/constants"
"os"
"strings"
"time"
@@ -10,6 +9,7 @@ import (
"github.com/briandowns/spinner"
"github.com/fatih/color"
"github.com/karrick/gows"
"github.com/turbot/pipe-fittings/constants"
)
// spinner format:

View File

@@ -2,10 +2,10 @@ package steampipeconfig
import (
"fmt"
"github.com/turbot/pipe-fittings/constants"
"log"
"strings"
"github.com/turbot/pipe-fittings/constants"
"github.com/turbot/pipe-fittings/utils"
sdkversion "github.com/turbot/steampipe-plugin-sdk/v5/version"
)

View File

@@ -4,21 +4,21 @@ import (
"bytes"
"context"
"fmt"
"github.com/turbot/pipe-fittings/constants"
plugin2 "github.com/turbot/pipe-fittings/plugin"
"os"
"sort"
"github.com/Masterminds/semver/v3"
"github.com/fatih/color"
"github.com/olekukonko/tablewriter"
"github.com/turbot/pipe-fittings/constants"
"github.com/turbot/pipe-fittings/plugin"
"github.com/turbot/pipe-fittings/utils"
)
type AvailableVersionCache struct {
StructVersion uint32 `json:"struct_version"`
CliCache *CLIVersionCheckResponse `json:"cli_version"`
PluginCache map[string]plugin2.PluginVersionCheckReport `json:"plugin_version"`
StructVersion uint32 `json:"struct_version"`
CliCache *CLIVersionCheckResponse `json:"cli_version"`
PluginCache map[string]plugin.PluginVersionCheckReport `json:"plugin_version"`
}
func (av *AvailableVersionCache) asTable(ctx context.Context) (*bytes.Buffer, error) {
@@ -107,10 +107,10 @@ func ppNotificationLines() []string {
}
func (av *AvailableVersionCache) pluginNotificationMessage(ctx context.Context) []string {
var pluginsToUpdate []plugin2.PluginVersionCheckReport
var pluginsToUpdate []plugin.PluginVersionCheckReport
for _, r := range av.PluginCache {
if plugin2.UpdateRequired(r) {
if plugin.UpdateRequired(r) {
pluginsToUpdate = append(pluginsToUpdate, r)
}
}
@@ -121,7 +121,7 @@ func (av *AvailableVersionCache) pluginNotificationMessage(ctx context.Context)
return notificationLines
}
func (av *AvailableVersionCache) getPluginNotificationLines(reports []plugin2.PluginVersionCheckReport) []string {
func (av *AvailableVersionCache) getPluginNotificationLines(reports []plugin.PluginVersionCheckReport) []string {
var notificationLines = []string{
"",
"Updated versions of the following plugins are available:",