Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor cosmetic and message updates #242

Merged
merged 4 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pkg/cmd/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ var (
)

const (
provideCacheMessage = "you must provide a cache name"
provideViewCacheMessage = "you must provide a view cache name"
provideCacheMessage = "you must provide a single cache name"
provideViewCacheMessage = "you must provide a single view cache name"
back = "back"
all = "all"
partitionDisplayType = "partition"
Expand Down Expand Up @@ -800,7 +800,7 @@ batchFactor, refreshFactor or requeueThreshold.`,
ValidArgsFunction: completionCaches,
Args: func(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
displayErrorAndExit(cmd, "you must provide a cache name")
displayErrorAndExit(cmd, provideCacheMessage)
}
return nil
},
Expand Down
24 changes: 12 additions & 12 deletions pkg/cmd/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ var (
)

const (
clusterMessage = "A cluster connection already exists with the name %s for %s\n"
ignoreErrorsMessage = "ignore errors from NS lookup"
youMustProviderClusterMessage = "you must provide a cluster name"
clusterMessage = "A cluster connection already exists with the name %s for %s\n"
ignoreErrorsMessage = "ignore errors from NS lookup"
youMustProviderConnectionMessage = "you must provide a single connection name"
)

// addClusterCmd represents the add cluster command
Expand All @@ -49,7 +49,7 @@ You can also specify host:port (for http connections) and the url will be automa
populated constructed.`,
Args: func(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
displayErrorAndExit(cmd, "you must provide a connection name")
displayErrorAndExit(cmd, youMustProviderConnectionMessage)
}
return nil
},
Expand All @@ -62,7 +62,7 @@ populated constructed.`,
}

if connectionURL == "" {
return errors.New("you must supply a connection url")
return errors.New("you must provide a connection url")
}

if err = addCluster(cmd, connection, connectionURL, "manual", ""); err != nil {
Expand All @@ -81,7 +81,7 @@ var removeClusterCmd = &cobra.Command{
ValidArgsFunction: completionAllClusters,
Args: func(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
displayErrorAndExit(cmd, "you must provide a connection name")
displayErrorAndExit(cmd, youMustProviderConnectionMessage)
}
return nil
},
Expand Down Expand Up @@ -203,7 +203,7 @@ addition information as well as '-v' to displayed additional information.`,
ValidArgsFunction: completionAllClusters,
Args: func(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
displayErrorAndExit(cmd, "you must provide a cluster connection")
displayErrorAndExit(cmd, "you must provide a single cluster connection")
}
return nil
},
Expand Down Expand Up @@ -774,7 +774,7 @@ commercial 14.1.1.2206.1 and above. Default version is currently CE ` + defaultC
NOTE: This is an experimental feature and my be altered or removed in the future.`,
Args: func(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
displayErrorAndExit(cmd, youMustProviderClusterMessage)
displayErrorAndExit(cmd, youMustProviderConnectionMessage)
}
return nil
},
Expand Down Expand Up @@ -1141,7 +1141,7 @@ var startClusterCmd = &cobra.Command{
ValidArgsFunction: completionAllManualClusters,
Args: func(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
displayErrorAndExit(cmd, youMustProviderClusterMessage)
displayErrorAndExit(cmd, youMustProviderConnectionMessage)
}
return nil
},
Expand All @@ -1161,7 +1161,7 @@ var scaleClusterCmd = &cobra.Command{
ValidArgsFunction: completionAllManualClusters,
Args: func(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
displayErrorAndExit(cmd, youMustProviderClusterMessage)
displayErrorAndExit(cmd, youMustProviderConnectionMessage)
}
return nil
},
Expand All @@ -1178,7 +1178,7 @@ var stopClusterCmd = &cobra.Command{
ValidArgsFunction: completionAllManualClusters,
Args: func(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
displayErrorAndExit(cmd, youMustProviderClusterMessage)
displayErrorAndExit(cmd, youMustProviderConnectionMessage)
}
return nil
},
Expand All @@ -1195,7 +1195,7 @@ var restartClusterCmd = &cobra.Command{
ValidArgsFunction: completionAllManualClusters,
Args: func(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
displayErrorAndExit(cmd, youMustProviderClusterMessage)
displayErrorAndExit(cmd, youMustProviderConnectionMessage)
}
return nil
},
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ var setContextCmd = &cobra.Command{
ValidArgsFunction: completionAllClusters,
Args: func(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
displayErrorAndExit(cmd, "you must provide a connection name")
displayErrorAndExit(cmd, youMustProviderConnectionMessage)
}
return nil
},
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ This includes details of the JVM as well as system properties.`,
ValidArgsFunction: completionNodeID,
Args: func(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
displayErrorAndExit(cmd, "you must provide a node id")
displayErrorAndExit(cmd, "you must provide a single node id")
}
return nil
},
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ var (
)

const (
provideExecutorName = "you must provide an executor name"
provideExecutorName = "you must provide a single executor name"
cannotFindExecutors = "unable to find any executors in this cluster"
stringTrue = "true"
stringFalse = "false"
Expand Down
12 changes: 6 additions & 6 deletions pkg/cmd/federation.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ import (
)

const (
destinations = "destinations"
origins = "origins"
destinations = "outgoing"
origins = "incoming"
outgoing = "outgoing"
incoming = "incoming"
participantMessage = "participant to apply to"
supplyService = "you must provide a service name"
supplyService = "you must provide a single federated service name"
federationUse = "federation service-name"
replicateAll = "replicateAll"
)
Expand All @@ -42,10 +42,10 @@ var (

// getFederationCmd represents the get federation command.
var getFederationCmd = &cobra.Command{
Use: "federation {destinations|origins|all}",
Use: "federation {outgoing|incoming|all}",
Short: "display federation details for a cluster",
Long: `The 'get federation' command displays the federation details for a cluster.
You must specify either destinations, origins or all to show both. You
You must specify either outgoing, incoming or all to show both. You
can also specify '-o wide' to display addition information.`,
Args: func(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
Expand Down Expand Up @@ -109,7 +109,7 @@ can also specify '-o wide' to display addition information.`,
jsonDataDest, _ := json.Marshal(finalSummariesDestinations)
jsonDataOrigins, _ := json.Marshal(finalSummariesOrigins)
finalData, err := utils.CombineByteArraysForJSON([][]byte{jsonDataDest, jsonDataOrigins},
[]string{"destinations", "origins"})
[]string{outgoing, incoming})
if err != nil {
return err
}
Expand Down
10 changes: 7 additions & 3 deletions pkg/cmd/formatting.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ func FormatFederationSummary(federationSummaries []config.FederationSummary, tar
fedCount = len(federationSummaries)
finalAlignment []string
suffix = "SENT"
participantCol = "DESTINATION"
participantCol = "OUTGOING"
memberCol = MembersColumn
formattingFunction = getFormattingFunction()
table FormattedTable
Expand All @@ -301,7 +301,7 @@ func FormatFederationSummary(federationSummaries []config.FederationSummary, tar
// setup columns and alignments
if target == origins {
suffix = "REC"
participantCol = "ORIGIN"
participantCol = "INCOMING"
memberCol = "MEMBERS RECEIVING"
}

Expand Down Expand Up @@ -1193,7 +1193,7 @@ func FormatClusterConnections(clusters []ClusterConnection) string {
return ""
}

table := newFormattedTable().WithHeader("CONNECTION", "TYPE", "URL", "VERSION", "CLUSTER NAME", "TYPE", "CTX", "LOCAL").
table := newFormattedTable().WithHeader("CONNECTION", "TYPE", "URL", "VERSION", "CLUSTER NAME", "TYPE", "CTX", "CREATED").
WithSortingColumn("CONNECTION")

for _, value := range clusters {
Expand Down Expand Up @@ -1715,6 +1715,10 @@ func FormatServices(services []config.ServiceSummary) string {
status = fmt.Sprintf("%d partitions are unbalanced", value.PartitionsUnbalanced)
}

if value.StorageEnabledCount == -1 {
value.StorageEnabledCount = 0
}

if value.QuorumStatus == "Suspended" {
suspended = "yes"
} else {
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/http_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ var describeHTTPProxyCmd = &cobra.Command{
ValidArgsFunction: completionHTTPServers,
Args: func(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
displayErrorAndExit(cmd, "you must provide a service name")
displayErrorAndExit(cmd, provideService)
}
return nil
},
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/http_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ var describeHTTPSessionCmd = &cobra.Command{
ValidArgsFunction: completionHTTPSessions,
Args: func(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
displayErrorAndExit(cmd, "you must provide an application id")
displayErrorAndExit(cmd, "you must provide a single application id")
}
return nil
},
Expand Down
10 changes: 5 additions & 5 deletions pkg/cmd/jfr.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var (

const (
jfrNameUse = "jfr name"
supplyJFR = "you must provide a JFR name"
provideJFR = "you must provide a single JFR name"
)

// getJfrsCmd represents the get jfrs command.
Expand Down Expand Up @@ -60,7 +60,7 @@ var describeJfrCmd = &cobra.Command{
Long: `The 'describe jfr' command shows information related to a Java Flight Recording (JFR).`,
Args: func(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
displayErrorAndExit(cmd, supplyJFR)
displayErrorAndExit(cmd, provideJFR)
}
return nil
},
Expand Down Expand Up @@ -90,7 +90,7 @@ be run for all members. The default duration is 60 seconds and you can specify a
of 0 to make the recording continuous.`,
Args: func(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
displayErrorAndExit(cmd, supplyJFR)
displayErrorAndExit(cmd, provideJFR)
}
return nil
},
Expand Down Expand Up @@ -179,7 +179,7 @@ var stopJfrCmd = &cobra.Command{
You can specify either a node or leave the node blank to stop for all nodes.`,
Args: func(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
displayErrorAndExit(cmd, supplyJFR)
displayErrorAndExit(cmd, provideJFR)
}
return nil
},
Expand Down Expand Up @@ -207,7 +207,7 @@ var dumpJfrCmd = &cobra.Command{
A JFR command mut be in progress for this to succeed.`,
Args: func(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
displayErrorAndExit(cmd, supplyJFR)
displayErrorAndExit(cmd, provideJFR)
}
return nil
},
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ var describeMachineCmd = &cobra.Command{
ValidArgsFunction: completionMachines,
Args: func(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
displayErrorAndExit(cmd, "you must provide a machine name")
displayErrorAndExit(cmd, "you must provide a single machine name")
}
return nil
},
Expand Down
8 changes: 4 additions & 4 deletions pkg/cmd/monitor_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
const (
defaultLayoutName = "default"
pressAdditional = "(press key in [] or mouse to toggle expand, ? = help)"
pressAdditionalReset = "(press key in [] or mouse to exit expand)"
pressAdditionalReset = "(press key in [] or mouse/ESC to exit expand)"
noContent = " No Content"
errorContent = "Unable to retrieve data"
unableToFindPanel = "unable to find panel [%v], use --help or --show-panels to see all options"
Expand Down Expand Up @@ -137,7 +137,7 @@ Use --show-panels to show all available panels.`,
ValidArgsFunction: completionAllClusters,
Args: func(cmd *cobra.Command, args []string) error {
if len(args) != 1 && !showAllPanels {
displayErrorAndExit(cmd, youMustProviderClusterMessage)
displayErrorAndExit(cmd, youMustProviderConnectionMessage)
}
return nil
},
Expand Down Expand Up @@ -282,7 +282,7 @@ Use --show-panels to show all available panels.`,
case *tcell.EventKey:
pressedKey := ev.Rune()
// Exit for 'q', ESC, or CTRL-C
if ev.Key() == tcell.KeyESC || ev.Key() == tcell.KeyCtrlC {
if (ev.Key() == tcell.KeyESC && expandedPanel == "") || ev.Key() == tcell.KeyCtrlC {
close(exit)
return nil
}
Expand Down Expand Up @@ -311,7 +311,7 @@ Use --show-panels to show all available panels.`,
if err := refresh(screen, dataFetcher, parsedLayout, false); err != nil {
panic(err)
}
} else if (pressedKey >= '1' && pressedKey <= '9' && pressedKey <= lastPanelCode) ||
} else if ((pressedKey >= '1' && pressedKey <= '9' && pressedKey <= lastPanelCode) || ev.Key() == tcell.KeyESC) ||
(pressedKey >= 'a' && pressedKey <= 'z' && pressedKey <= lastPanelCode) {
updateExpanded(pressedKey, screen, dataFetcher, parsedLayout)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/panel.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/spf13/viper"
)

const providePanelName = "you must provide a panel name"
const providePanelName = "you must provide a single panel name"

var panelLayout string

Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"regexp"
)

const provideProfileName = "you must provide a profile name"
const provideProfileName = "you must provide a single profile name"

var (
isValid = regexp.MustCompile(`^[A-Za-z\d-]+$`).MatchString
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
)

const (
provideProxyService = "you must provide a proxy service name"
provideProxyService = "you must provide a single proxy service name"
proxyErrorMsg = "unable to find proxy service with service name"
tcpString = "tcp"
)
Expand Down
4 changes: 2 additions & 2 deletions pkg/cmd/reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const (
reporterIntervalSeconds = "intervalSeconds"
reporterOutputPath = "outputPath"
reporterUse = "reporter node-id"
provideNodeID = "you must provide a node id"
provideNodeID = "you must provide a single node id"
)

var (
Expand Down Expand Up @@ -165,7 +165,7 @@ The report name should not include the .xml extension and will have the 'report'
'report-node' will expand to 'reports/report-node.xml'. A HTTP 400 will be returned if the report name is not valid.`,
Args: func(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
displayErrorAndExit(cmd, "you must provide a report name")
displayErrorAndExit(cmd, "you must provide a single report name")
}
return nil
},
Expand Down
6 changes: 3 additions & 3 deletions pkg/cmd/reset_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ var resetServiceStatsCmd = &cobra.Command{
ValidArgsFunction: completionService,
Args: func(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
displayErrorAndExit(cmd, provideServiceName)
displayErrorAndExit(cmd, provideService)
}
return nil
},
Expand All @@ -115,7 +115,7 @@ var resetProxyStatsCmd = &cobra.Command{
ValidArgsFunction: completionProxies,
Args: func(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
displayErrorAndExit(cmd, provideServiceName)
displayErrorAndExit(cmd, provideService)
}
return nil
},
Expand Down Expand Up @@ -148,7 +148,7 @@ var resetFederationStatsCmd = &cobra.Command{
Long: `The 'reset federation-stats' command resets federation statistics for all members or a comma separated list of member IDs.`,
Args: func(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
displayErrorAndExit(cmd, provideServiceName)
displayErrorAndExit(cmd, provideService)
}
return nil
},
Expand Down
Loading
Loading