Skip to content

Commit

Permalink
Remove sps references from help messages
Browse files Browse the repository at this point in the history
  • Loading branch information
pskrbasu authored Jun 5, 2024
1 parent aa27aa6 commit 805699f
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 10 deletions.
2 changes: 1 addition & 1 deletion internal/cmd/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ The current mod is the working directory, or the directory specified by the --mo
AddCloudFlags().
AddModLocationFlag().
AddStringArrayFlag(constants.ArgArg, nil, "Specify the value of a dashboard argument").
AddStringSliceFlag(constants.ArgExport, nil, "Export output to file, supported format: sps (snapshot)").
AddStringSliceFlag(constants.ArgExport, nil, "Export output to file, supported format: pps (snapshot)").
AddStringFlag(constants.ArgDatabase, app_specific.DefaultDatabase, "Turbot Pipes workspace database").
AddIntFlag(constants.ArgDatabaseQueryTimeout, localconstants.DatabaseDefaultQueryTimeout, "The query timeout").
AddBoolFlag(constants.ArgHelp, false, "Help for dashboard", cmdconfig.FlagOptions.WithShortHand("h")).
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ The current mod is the working directory, or the directory specified by the --mo
AddStringArrayFlag(constants.ArgArg, nil, "Specify the value of a query argument").
AddStringFlag(constants.ArgDatabase, app_specific.DefaultDatabase, "Turbot Pipes workspace database").
AddIntFlag(constants.ArgDatabaseQueryTimeout, localconstants.DatabaseDefaultQueryTimeout, "The query timeout").
AddStringSliceFlag(constants.ArgExport, nil, "Export output to file, supported formats: csv, html, json, md, nunit3, sps (snapshot), asff").
AddStringSliceFlag(constants.ArgExport, nil, "Export output to file, supported formats: csv, html, json, md, nunit3, pps (snapshot), asff").
AddBoolFlag(constants.ArgHeader, true, "Include column headers for csv and table output").
AddBoolFlag(constants.ArgHelp, false, "Help for query", cmdconfig.FlagOptions.WithShortHand("h")).
AddBoolFlag(constants.ArgInput, true, "Enable interactive prompts").
Expand Down
5 changes: 5 additions & 0 deletions internal/constants/extensions.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package constants

const (
SnapshotExtension = ".pps"
)
9 changes: 6 additions & 3 deletions internal/constants/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,15 @@ const (
QueryOutputModeNone
)

// powerpipe snapshot
const OutputFormatPpSnapshotShort = "pps"

var QueryOutputModeIds = map[QueryOutputMode][]string{
QueryOutputModeCsv: {constants.OutputFormatCSV},
QueryOutputModeJson: {constants.OutputFormatJSON},
QueryOutputModeLine: {constants.OutputFormatLine},
QueryOutputModeSnapshot: {constants.OutputFormatSnapshot},
QueryOutputModeSnapshotShort: {constants.OutputFormatSnapshotShort},
QueryOutputModeSnapshotShort: {OutputFormatPpSnapshotShort},
QueryOutputModeTable: {constants.OutputFormatTable},
QueryOutputModeNone: {constants.OutputFormatNone},
}
Expand All @@ -55,7 +58,7 @@ const (

var DashboardOutputModeIds = map[DashboardOutputMode][]string{
DashboardOutputModeSnapshot: {constants.OutputFormatSnapshot},
DashboardOutputModeSnapshotShort: {constants.OutputFormatSnapshotShort},
DashboardOutputModeSnapshotShort: {OutputFormatPpSnapshotShort},
DashboardOutputModeNone: {constants.OutputFormatNone},
}

Expand Down Expand Up @@ -83,6 +86,6 @@ var CheckOutputModeIds = map[CheckOutputMode][]string{
CheckOutputModeMd: {constants.OutputFormatMD},
CheckOutputModeTest: {constants.OutputFormatText},
CheckOutputModeSnapshot: {constants.OutputFormatSnapshot},
CheckOutputModeSnapshotShort: {constants.OutputFormatSnapshotShort},
CheckOutputModeSnapshotShort: {OutputFormatPpSnapshotShort},
CheckOutputModeNone: {constants.OutputFormatNone},
}
5 changes: 3 additions & 2 deletions internal/controldisplay/formatter_snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"strings"

"github.com/turbot/pipe-fittings/constants"
localconstants "github.com/turbot/powerpipe/internal/constants"
"github.com/turbot/powerpipe/internal/controlexecute"
)

Expand Down Expand Up @@ -38,13 +39,13 @@ func (f *SnapshotFormatter) Format(ctx context.Context, tree *controlexecute.Exe
}

func (f *SnapshotFormatter) FileExtension() string {
return constants.SnapshotExtension
return localconstants.SnapshotExtension
}

func (f SnapshotFormatter) Name() string {
return constants.OutputFormatSnapshot
}

func (f *SnapshotFormatter) Alias() string {
return "pps"
return localconstants.OutputFormatPpSnapshotShort
}
7 changes: 4 additions & 3 deletions internal/controldisplay/formatter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ package controldisplay

import (
"context"
"github.com/turbot/pipe-fittings/app_specific"
"io"
"os"
"testing"

"github.com/turbot/pipe-fittings/app_specific"
"github.com/turbot/pipe-fittings/constants"
localconstants "github.com/turbot/powerpipe/internal/constants"
"github.com/turbot/powerpipe/internal/controlexecute"
)

Expand Down Expand Up @@ -39,8 +40,8 @@ var formatterTestCase = []testCase{
{
input: "snapshot",
expected: testFormatter{
alias: "pps",
extension: constants.SnapshotExtension,
alias: localconstants.OutputFormatPpSnapshotShort,
extension: localconstants.SnapshotExtension,
name: constants.OutputFormatSnapshot,
},
},
Expand Down

0 comments on commit 805699f

Please sign in to comment.