diff --git a/cmd/rhoas/main.go b/cmd/rhoas/main.go index 16621d9db..02ce554c5 100644 --- a/cmd/rhoas/main.go +++ b/cmd/rhoas/main.go @@ -2,18 +2,13 @@ package main import ( "context" - "encoding/json" "fmt" "os" - "github.com/redhat-developer/app-services-cli/pkg/api/kas" "github.com/redhat-developer/app-services-cli/pkg/doc" - "github.com/redhat-developer/app-services-cli/pkg/dump" "github.com/redhat-developer/app-services-cli/pkg/localize" "github.com/redhat-developer/app-services-cli/pkg/localize/goi18n" - "github.com/redhat-developer/app-services-cli/pkg/cmdutil" - "github.com/redhat-developer/app-services-cli/internal/build" "github.com/redhat-developer/app-services-cli/internal/config" @@ -57,24 +52,16 @@ func main() { } err = rootCmd.Execute() - if debug.Enabled() { - build.CheckForUpdate(context.Background(), logger, localizer) - } if err == nil { - return - } - - if e, ok := kas.GetAPIError(err); ok { - logger.Error("Error:", e.GetReason()) if debug.Enabled() { - errJSON, _ := json.Marshal(e) - _ = dump.JSON(cmdFactory.IOStreams.ErrOut, errJSON) + build.CheckForUpdate(context.Background(), logger, localizer) } - os.Exit(1) + return } - if err = cmdutil.CheckSurveyError(err); err != nil { - logger.Error("Error:", err) + if err != nil { + logger.Error(wrapErrorf(err, localizer)) + build.CheckForUpdate(context.Background(), logger, localizer) os.Exit(1) } } @@ -131,3 +118,7 @@ func initConfig(f *factory.Factory) error { } return nil } + +func wrapErrorf(err error, localizer localize.Localizer) error { + return fmt.Errorf("Error: %w. %v", err, localizer.MustLocalize("common.log.error.verboseModeHint")) +} diff --git a/docs/commands/rhoas.adoc b/docs/commands/rhoas.adoc index 199773b94..1273d9691 100644 --- a/docs/commands/rhoas.adoc +++ b/docs/commands/rhoas.adoc @@ -31,8 +31,9 @@ $ rhoas cluster connect [discrete] == Options - `-d`, `--debug`:: Enable debug mode - `-h`, `--help`:: Show help for a command + `-h`, `--help`:: Show help for a command + `-v`, `--verbose`:: Enable verbose mode + `--version`:: Show rhoas version [discrete] == See also diff --git a/docs/commands/rhoas_cluster.adoc b/docs/commands/rhoas_cluster.adoc index b0d5a1ed3..1dca0e7aa 100644 --- a/docs/commands/rhoas_cluster.adoc +++ b/docs/commands/rhoas_cluster.adoc @@ -29,8 +29,9 @@ $ rhoas cluster bind [discrete] == Options inherited from parent commands - `-d`, `--debug`:: Enable debug mode - `-h`, `--help`:: Show help for a command + `-h`, `--help`:: Show help for a command + `-v`, `--verbose`:: Enable verbose mode + `--version`:: Show rhoas version [discrete] == See also diff --git a/docs/commands/rhoas_cluster_bind.adoc b/docs/commands/rhoas_cluster_bind.adoc index 00062711f..21faada36 100644 --- a/docs/commands/rhoas_cluster_bind.adoc +++ b/docs/commands/rhoas_cluster_bind.adoc @@ -52,8 +52,9 @@ $ rhoas cluster bind --namespace=ns --app-name=myapp [discrete] == Options inherited from parent commands - `-d`, `--debug`:: Enable debug mode - `-h`, `--help`:: Show help for a command + `-h`, `--help`:: Show help for a command + `-v`, `--verbose`:: Enable verbose mode + `--version`:: Show rhoas version [discrete] == See also diff --git a/docs/commands/rhoas_cluster_connect.adoc b/docs/commands/rhoas_cluster_connect.adoc index e19cc7cfe..f91422cd5 100644 --- a/docs/commands/rhoas_cluster_connect.adoc +++ b/docs/commands/rhoas_cluster_connect.adoc @@ -50,8 +50,9 @@ $ rhoas cluster connect [discrete] == Options inherited from parent commands - `-d`, `--debug`:: Enable debug mode - `-h`, `--help`:: Show help for a command + `-h`, `--help`:: Show help for a command + `-v`, `--verbose`:: Enable verbose mode + `--version`:: Show rhoas version [discrete] == See also diff --git a/docs/commands/rhoas_cluster_status.adoc b/docs/commands/rhoas_cluster_status.adoc index 8d8e14960..082b73dd9 100644 --- a/docs/commands/rhoas_cluster_status.adoc +++ b/docs/commands/rhoas_cluster_status.adoc @@ -36,8 +36,9 @@ $ rhoas cluster status [discrete] == Options inherited from parent commands - `-d`, `--debug`:: Enable debug mode - `-h`, `--help`:: Show help for a command + `-h`, `--help`:: Show help for a command + `-v`, `--verbose`:: Enable verbose mode + `--version`:: Show rhoas version [discrete] == See also diff --git a/docs/commands/rhoas_completion.adoc b/docs/commands/rhoas_completion.adoc index e394d674b..58f737319 100644 --- a/docs/commands/rhoas_completion.adoc +++ b/docs/commands/rhoas_completion.adoc @@ -20,8 +20,9 @@ When you have installed the command completion script, make sure you restart you [discrete] == Options inherited from parent commands - `-d`, `--debug`:: Enable debug mode - `-h`, `--help`:: Show help for a command + `-h`, `--help`:: Show help for a command + `-v`, `--verbose`:: Enable verbose mode + `--version`:: Show rhoas version [discrete] == See also diff --git a/docs/commands/rhoas_completion_bash.adoc b/docs/commands/rhoas_completion_bash.adoc index 8fb654a64..3eb73823c 100644 --- a/docs/commands/rhoas_completion_bash.adoc +++ b/docs/commands/rhoas_completion_bash.adoc @@ -28,8 +28,9 @@ rhoas completion bash [discrete] == Options inherited from parent commands - `-d`, `--debug`:: Enable debug mode - `-h`, `--help`:: Show help for a command + `-h`, `--help`:: Show help for a command + `-v`, `--verbose`:: Enable verbose mode + `--version`:: Show rhoas version [discrete] == See also diff --git a/docs/commands/rhoas_completion_fish.adoc b/docs/commands/rhoas_completion_fish.adoc index 155798faf..1ba4d83e4 100644 --- a/docs/commands/rhoas_completion_fish.adoc +++ b/docs/commands/rhoas_completion_fish.adoc @@ -20,8 +20,9 @@ rhoas completion fish [discrete] == Options inherited from parent commands - `-d`, `--debug`:: Enable debug mode - `-h`, `--help`:: Show help for a command + `-h`, `--help`:: Show help for a command + `-v`, `--verbose`:: Enable verbose mode + `--version`:: Show rhoas version [discrete] == See also diff --git a/docs/commands/rhoas_completion_zsh.adoc b/docs/commands/rhoas_completion_zsh.adoc index 5d7024bcf..aad69e825 100644 --- a/docs/commands/rhoas_completion_zsh.adoc +++ b/docs/commands/rhoas_completion_zsh.adoc @@ -22,8 +22,9 @@ rhoas completion zsh [discrete] == Options inherited from parent commands - `-d`, `--debug`:: Enable debug mode - `-h`, `--help`:: Show help for a command + `-h`, `--help`:: Show help for a command + `-v`, `--verbose`:: Enable verbose mode + `--version`:: Show rhoas version [discrete] == See also diff --git a/docs/commands/rhoas_config.adoc b/docs/commands/rhoas_config.adoc index 16988b398..691f230bc 100644 --- a/docs/commands/rhoas_config.adoc +++ b/docs/commands/rhoas_config.adoc @@ -23,8 +23,9 @@ $ rhoas config dev-preview true [discrete] == Options inherited from parent commands - `-d`, `--debug`:: Enable debug mode - `-h`, `--help`:: Show help for a command + `-h`, `--help`:: Show help for a command + `-v`, `--verbose`:: Enable verbose mode + `--version`:: Show rhoas version [discrete] == See also diff --git a/docs/commands/rhoas_config_dev-preview.adoc b/docs/commands/rhoas_config_dev-preview.adoc index 2da0cf95f..4674759f0 100644 --- a/docs/commands/rhoas_config_dev-preview.adoc +++ b/docs/commands/rhoas_config_dev-preview.adoc @@ -28,8 +28,9 @@ $ rhoas config dev-preview true [discrete] == Options inherited from parent commands - `-d`, `--debug`:: Enable debug mode - `-h`, `--help`:: Show help for a command + `-h`, `--help`:: Show help for a command + `-v`, `--verbose`:: Enable verbose mode + `--version`:: Show rhoas version [discrete] == See also diff --git a/docs/commands/rhoas_kafka.adoc b/docs/commands/rhoas_kafka.adoc index 0ccaf3a29..8600f88ea 100644 --- a/docs/commands/rhoas_kafka.adoc +++ b/docs/commands/rhoas_kafka.adoc @@ -8,8 +8,9 @@ Create, view, use, and manage your Apache Kafka instances [discrete] == Options inherited from parent commands - `-d`, `--debug`:: Enable debug mode - `-h`, `--help`:: Show help for a command + `-h`, `--help`:: Show help for a command + `-v`, `--verbose`:: Enable verbose mode + `--version`:: Show rhoas version [discrete] == See also diff --git a/docs/commands/rhoas_kafka_consumer-group.adoc b/docs/commands/rhoas_kafka_consumer-group.adoc index fdafe3638..f68f0b0dc 100644 --- a/docs/commands/rhoas_kafka_consumer-group.adoc +++ b/docs/commands/rhoas_kafka_consumer-group.adoc @@ -13,8 +13,9 @@ Use these commands to describe, list, and delete consumer groups for the current [discrete] == Options inherited from parent commands - `-d`, `--debug`:: Enable debug mode - `-h`, `--help`:: Show help for a command + `-h`, `--help`:: Show help for a command + `-v`, `--verbose`:: Enable verbose mode + `--version`:: Show rhoas version [discrete] == See also diff --git a/docs/commands/rhoas_kafka_consumer-group_delete.adoc b/docs/commands/rhoas_kafka_consumer-group_delete.adoc index 00710f0f1..582a986d0 100644 --- a/docs/commands/rhoas_kafka_consumer-group_delete.adoc +++ b/docs/commands/rhoas_kafka_consumer-group_delete.adoc @@ -33,8 +33,9 @@ $ rhoas kafka consumer-group delete consumer_group_1 [discrete] == Options inherited from parent commands - `-d`, `--debug`:: Enable debug mode - `-h`, `--help`:: Show help for a command + `-h`, `--help`:: Show help for a command + `-v`, `--verbose`:: Enable verbose mode + `--version`:: Show rhoas version [discrete] == See also diff --git a/docs/commands/rhoas_kafka_consumer-group_describe.adoc b/docs/commands/rhoas_kafka_consumer-group_describe.adoc index e849d0264..e170558b9 100644 --- a/docs/commands/rhoas_kafka_consumer-group_describe.adoc +++ b/docs/commands/rhoas_kafka_consumer-group_describe.adoc @@ -33,8 +33,9 @@ $ rhoas kafka consumer-group describe consumer_group_1 -o json [discrete] == Options inherited from parent commands - `-d`, `--debug`:: Enable debug mode - `-h`, `--help`:: Show help for a command + `-h`, `--help`:: Show help for a command + `-v`, `--verbose`:: Enable verbose mode + `--version`:: Show rhoas version [discrete] == See also diff --git a/docs/commands/rhoas_kafka_consumer-group_list.adoc b/docs/commands/rhoas_kafka_consumer-group_list.adoc index 1235efb39..6f923278a 100644 --- a/docs/commands/rhoas_kafka_consumer-group_list.adoc +++ b/docs/commands/rhoas_kafka_consumer-group_list.adoc @@ -38,8 +38,9 @@ $ rhoas kafka consumer-group list -o json [discrete] == Options inherited from parent commands - `-d`, `--debug`:: Enable debug mode - `-h`, `--help`:: Show help for a command + `-h`, `--help`:: Show help for a command + `-v`, `--verbose`:: Enable verbose mode + `--version`:: Show rhoas version [discrete] == See also diff --git a/docs/commands/rhoas_kafka_create.adoc b/docs/commands/rhoas_kafka_create.adoc index b4f184052..9a5e754f1 100644 --- a/docs/commands/rhoas_kafka_create.adoc +++ b/docs/commands/rhoas_kafka_create.adoc @@ -43,8 +43,9 @@ $ rhoas kafka create -o yaml [discrete] == Options inherited from parent commands - `-d`, `--debug`:: Enable debug mode - `-h`, `--help`:: Show help for a command + `-h`, `--help`:: Show help for a command + `-v`, `--verbose`:: Enable verbose mode + `--version`:: Show rhoas version [discrete] == See also diff --git a/docs/commands/rhoas_kafka_delete.adoc b/docs/commands/rhoas_kafka_delete.adoc index fcaca81f9..a4b98ba8a 100644 --- a/docs/commands/rhoas_kafka_delete.adoc +++ b/docs/commands/rhoas_kafka_delete.adoc @@ -39,8 +39,9 @@ $ rhoas kafka delete --id=1iSY6RQ3JKI8Q0OTmjQFd3ocFRg [discrete] == Options inherited from parent commands - `-d`, `--debug`:: Enable debug mode - `-h`, `--help`:: Show help for a command + `-h`, `--help`:: Show help for a command + `-v`, `--verbose`:: Enable verbose mode + `--version`:: Show rhoas version [discrete] == See also diff --git a/docs/commands/rhoas_kafka_describe.adoc b/docs/commands/rhoas_kafka_describe.adoc index acfec3c7e..1a83aa23e 100644 --- a/docs/commands/rhoas_kafka_describe.adoc +++ b/docs/commands/rhoas_kafka_describe.adoc @@ -45,8 +45,9 @@ $ rhoas kafka describe -o yaml [discrete] == Options inherited from parent commands - `-d`, `--debug`:: Enable debug mode - `-h`, `--help`:: Show help for a command + `-h`, `--help`:: Show help for a command + `-v`, `--verbose`:: Enable verbose mode + `--version`:: Show rhoas version [discrete] == See also diff --git a/docs/commands/rhoas_kafka_list.adoc b/docs/commands/rhoas_kafka_list.adoc index c4eb9d140..d9cd2e062 100644 --- a/docs/commands/rhoas_kafka_list.adoc +++ b/docs/commands/rhoas_kafka_list.adoc @@ -32,8 +32,9 @@ rhoas kafka list [flags] [discrete] == Options inherited from parent commands - `-d`, `--debug`:: Enable debug mode - `-h`, `--help`:: Show help for a command + `-h`, `--help`:: Show help for a command + `-v`, `--verbose`:: Enable verbose mode + `--version`:: Show rhoas version [discrete] == See also diff --git a/docs/commands/rhoas_kafka_topic.adoc b/docs/commands/rhoas_kafka_topic.adoc index ae6884803..e5bfabf63 100644 --- a/docs/commands/rhoas_kafka_topic.adoc +++ b/docs/commands/rhoas_kafka_topic.adoc @@ -13,8 +13,9 @@ Create, describe, update, list and delete topics for the current Kafka instance. [discrete] == Options inherited from parent commands - `-d`, `--debug`:: Enable debug mode - `-h`, `--help`:: Show help for a command + `-h`, `--help`:: Show help for a command + `-v`, `--verbose`:: Enable verbose mode + `--version`:: Show rhoas version [discrete] == See also diff --git a/docs/commands/rhoas_kafka_topic_create.adoc b/docs/commands/rhoas_kafka_topic_create.adoc index bb217dcaf..52c74c93b 100644 --- a/docs/commands/rhoas_kafka_topic_create.adoc +++ b/docs/commands/rhoas_kafka_topic_create.adoc @@ -39,8 +39,9 @@ $ rhoas kafka topic create topic-1 [discrete] == Options inherited from parent commands - `-d`, `--debug`:: Enable debug mode - `-h`, `--help`:: Show help for a command + `-h`, `--help`:: Show help for a command + `-v`, `--verbose`:: Enable verbose mode + `--version`:: Show rhoas version [discrete] == See also diff --git a/docs/commands/rhoas_kafka_topic_delete.adoc b/docs/commands/rhoas_kafka_topic_delete.adoc index 10e03a4b0..783f31680 100644 --- a/docs/commands/rhoas_kafka_topic_delete.adoc +++ b/docs/commands/rhoas_kafka_topic_delete.adoc @@ -32,8 +32,9 @@ $ rhoas kafka topic delete topic-1 [discrete] == Options inherited from parent commands - `-d`, `--debug`:: Enable debug mode - `-h`, `--help`:: Show help for a command + `-h`, `--help`:: Show help for a command + `-v`, `--verbose`:: Enable verbose mode + `--version`:: Show rhoas version [discrete] == See also diff --git a/docs/commands/rhoas_kafka_topic_describe.adoc b/docs/commands/rhoas_kafka_topic_describe.adoc index 27f171b6a..306558af7 100644 --- a/docs/commands/rhoas_kafka_topic_describe.adoc +++ b/docs/commands/rhoas_kafka_topic_describe.adoc @@ -32,8 +32,9 @@ $ rhoas kafka topic describe topic-1 [discrete] == Options inherited from parent commands - `-d`, `--debug`:: Enable debug mode - `-h`, `--help`:: Show help for a command + `-h`, `--help`:: Show help for a command + `-v`, `--verbose`:: Enable verbose mode + `--version`:: Show rhoas version [discrete] == See also diff --git a/docs/commands/rhoas_kafka_topic_list.adoc b/docs/commands/rhoas_kafka_topic_list.adoc index e89a517ec..f7715faad 100644 --- a/docs/commands/rhoas_kafka_topic_list.adoc +++ b/docs/commands/rhoas_kafka_topic_list.adoc @@ -38,8 +38,9 @@ $ rhoas kafka topic list -o json [discrete] == Options inherited from parent commands - `-d`, `--debug`:: Enable debug mode - `-h`, `--help`:: Show help for a command + `-h`, `--help`:: Show help for a command + `-v`, `--verbose`:: Enable verbose mode + `--version`:: Show rhoas version [discrete] == See also diff --git a/docs/commands/rhoas_kafka_topic_update.adoc b/docs/commands/rhoas_kafka_topic_update.adoc index fd9c27757..bf0cba8a2 100644 --- a/docs/commands/rhoas_kafka_topic_update.adoc +++ b/docs/commands/rhoas_kafka_topic_update.adoc @@ -36,8 +36,9 @@ $ rhoas kafka topic update topic-1 --retention-ms -1 [discrete] == Options inherited from parent commands - `-d`, `--debug`:: Enable debug mode - `-h`, `--help`:: Show help for a command + `-h`, `--help`:: Show help for a command + `-v`, `--verbose`:: Enable verbose mode + `--version`:: Show rhoas version [discrete] == See also diff --git a/docs/commands/rhoas_kafka_use.adoc b/docs/commands/rhoas_kafka_use.adoc index 493fa2f31..6e358a74e 100644 --- a/docs/commands/rhoas_kafka_use.adoc +++ b/docs/commands/rhoas_kafka_use.adoc @@ -36,8 +36,9 @@ $ rhoas kafka use --id=1iSY6RQ3JKI8Q0OTmjQFd3ocFRg, [discrete] == Options inherited from parent commands - `-d`, `--debug`:: Enable debug mode - `-h`, `--help`:: Show help for a command + `-h`, `--help`:: Show help for a command + `-v`, `--verbose`:: Enable verbose mode + `--version`:: Show rhoas version [discrete] == See also diff --git a/docs/commands/rhoas_login.adoc b/docs/commands/rhoas_login.adoc index 112ba436a..617eacebc 100644 --- a/docs/commands/rhoas_login.adoc +++ b/docs/commands/rhoas_login.adoc @@ -51,8 +51,9 @@ $ rhoas login --token [discrete] == Options inherited from parent commands - `-d`, `--debug`:: Enable debug mode - `-h`, `--help`:: Show help for a command + `-h`, `--help`:: Show help for a command + `-v`, `--verbose`:: Enable verbose mode + `--version`:: Show rhoas version [discrete] == See also diff --git a/docs/commands/rhoas_logout.adoc b/docs/commands/rhoas_logout.adoc index 5f3667a75..7e4266ed8 100644 --- a/docs/commands/rhoas_logout.adoc +++ b/docs/commands/rhoas_logout.adoc @@ -17,8 +17,9 @@ rhoas logout [flags] [discrete] == Options inherited from parent commands - `-d`, `--debug`:: Enable debug mode - `-h`, `--help`:: Show help for a command + `-h`, `--help`:: Show help for a command + `-v`, `--verbose`:: Enable verbose mode + `--version`:: Show rhoas version [discrete] == See also diff --git a/docs/commands/rhoas_service-account.adoc b/docs/commands/rhoas_service-account.adoc index 6c7735a05..56dff1cb0 100644 --- a/docs/commands/rhoas_service-account.adoc +++ b/docs/commands/rhoas_service-account.adoc @@ -13,8 +13,9 @@ Use these commands to create, list, describe, delete and update service accounts [discrete] == Options inherited from parent commands - `-d`, `--debug`:: Enable debug mode - `-h`, `--help`:: Show help for a command + `-h`, `--help`:: Show help for a command + `-v`, `--verbose`:: Enable verbose mode + `--version`:: Show rhoas version [discrete] == See also diff --git a/docs/commands/rhoas_service-account_create.adoc b/docs/commands/rhoas_service-account_create.adoc index 8c4fe9870..af57a6d62 100644 --- a/docs/commands/rhoas_service-account_create.adoc +++ b/docs/commands/rhoas_service-account_create.adoc @@ -53,8 +53,9 @@ $ rhoas service-account create --file-location=./service-acct-credentials.json [discrete] == Options inherited from parent commands - `-d`, `--debug`:: Enable debug mode - `-h`, `--help`:: Show help for a command + `-h`, `--help`:: Show help for a command + `-v`, `--verbose`:: Enable verbose mode + `--version`:: Show rhoas version [discrete] == See also diff --git a/docs/commands/rhoas_service-account_delete.adoc b/docs/commands/rhoas_service-account_delete.adoc index 2139488a8..4a46556b6 100644 --- a/docs/commands/rhoas_service-account_delete.adoc +++ b/docs/commands/rhoas_service-account_delete.adoc @@ -36,8 +36,9 @@ $ rhoas service-account delete --id 173c1ad9-932d-4007-ae0f-4da74f4d2ccd [discrete] == Options inherited from parent commands - `-d`, `--debug`:: Enable debug mode - `-h`, `--help`:: Show help for a command + `-h`, `--help`:: Show help for a command + `-v`, `--verbose`:: Enable verbose mode + `--version`:: Show rhoas version [discrete] == See also diff --git a/docs/commands/rhoas_service-account_describe.adoc b/docs/commands/rhoas_service-account_describe.adoc index 7a69e4257..352f8474e 100644 --- a/docs/commands/rhoas_service-account_describe.adoc +++ b/docs/commands/rhoas_service-account_describe.adoc @@ -37,8 +37,9 @@ $ rhoas service-account describe --id=8a06e685-f827-44bc-b0a7-250bc8abe52e --out [discrete] == Options inherited from parent commands - `-d`, `--debug`:: Enable debug mode - `-h`, `--help`:: Show help for a command + `-h`, `--help`:: Show help for a command + `-v`, `--verbose`:: Enable verbose mode + `--version`:: Show rhoas version [discrete] == See also diff --git a/docs/commands/rhoas_service-account_list.adoc b/docs/commands/rhoas_service-account_list.adoc index 33e10bc89..861dc79f4 100644 --- a/docs/commands/rhoas_service-account_list.adoc +++ b/docs/commands/rhoas_service-account_list.adoc @@ -40,8 +40,9 @@ $ rhoas kafka list -o json [discrete] == Options inherited from parent commands - `-d`, `--debug`:: Enable debug mode - `-h`, `--help`:: Show help for a command + `-h`, `--help`:: Show help for a command + `-v`, `--verbose`:: Enable verbose mode + `--version`:: Show rhoas version [discrete] == See also diff --git a/docs/commands/rhoas_service-account_reset-credentials.adoc b/docs/commands/rhoas_service-account_reset-credentials.adoc index 0209937fa..19bff6ac7 100644 --- a/docs/commands/rhoas_service-account_reset-credentials.adoc +++ b/docs/commands/rhoas_service-account_reset-credentials.adoc @@ -48,8 +48,9 @@ $ rhoas service-account reset-credentials --id 173c1ad9-932d-4007-ae0f-4da74f4d2 [discrete] == Options inherited from parent commands - `-d`, `--debug`:: Enable debug mode - `-h`, `--help`:: Show help for a command + `-h`, `--help`:: Show help for a command + `-v`, `--verbose`:: Enable verbose mode + `--version`:: Show rhoas version [discrete] == See also diff --git a/docs/commands/rhoas_status.adoc b/docs/commands/rhoas_status.adoc index 79b3060b2..2623f1a0c 100644 --- a/docs/commands/rhoas_status.adoc +++ b/docs/commands/rhoas_status.adoc @@ -41,8 +41,9 @@ $ rhoas status -o json [discrete] == Options inherited from parent commands - `-d`, `--debug`:: Enable debug mode - `-h`, `--help`:: Show help for a command + `-h`, `--help`:: Show help for a command + `-v`, `--verbose`:: Enable verbose mode + `--version`:: Show rhoas version [discrete] == See also diff --git a/docs/commands/rhoas_whoami.adoc b/docs/commands/rhoas_whoami.adoc index 09439e01e..b1cec65a3 100644 --- a/docs/commands/rhoas_whoami.adoc +++ b/docs/commands/rhoas_whoami.adoc @@ -29,8 +29,9 @@ $ rhoas whoami [discrete] == Options inherited from parent commands - `-d`, `--debug`:: Enable debug mode - `-h`, `--help`:: Show help for a command + `-h`, `--help`:: Show help for a command + `-v`, `--verbose`:: Enable verbose mode + `--version`:: Show rhoas version [discrete] == See also diff --git a/pkg/cmd/debug/flag.go b/pkg/cmd/debug/flag.go index a85533946..e21b7fbcc 100644 --- a/pkg/cmd/debug/flag.go +++ b/pkg/cmd/debug/flag.go @@ -4,21 +4,21 @@ package debug import "github.com/spf13/pflag" -// AddFlag adds the debug flag to the given set of command line flags. +// AddFlag adds the verbose flag to the given set of command line flags. func AddFlag(flags *pflag.FlagSet) { flags.BoolVarP( &enabled, - "debug", - "d", + "verbose", + "v", false, - "Enable debug mode", + "Enable verbose mode", ) } -// Enabled returns a boolean flag that indicates if the debug mode is enabled +// Enabled returns a boolean flag that indicates if the verbose mode is enabled func Enabled() bool { return enabled } -// enabled is a boolean flag that indicates that the debug mode is enabled +// enabled is a boolean flag that indicates that the verbose mode is enabled var enabled bool diff --git a/pkg/cmd/root/root.go b/pkg/cmd/root/root.go index 39d1daa2e..a3f14a694 100644 --- a/pkg/cmd/root/root.go +++ b/pkg/cmd/root/root.go @@ -7,11 +7,9 @@ import ( "github.com/redhat-developer/app-services-cli/pkg/cmd/registry" - "github.com/redhat-developer/app-services-cli/internal/build" "github.com/redhat-developer/app-services-cli/pkg/cmd/login" "github.com/redhat-developer/app-services-cli/pkg/cmd/status" "github.com/redhat-developer/app-services-cli/pkg/cmd/whoami" - "github.com/redhat-developer/app-services-cli/pkg/localize" "github.com/redhat-developer/app-services-cli/pkg/arguments" "github.com/redhat-developer/app-services-cli/pkg/cmd/cluster" @@ -40,10 +38,11 @@ func NewRootCommand(f *factory.Factory, version string) *cobra.Command { var help bool fs.BoolVarP(&help, "help", "h", false, f.Localizer.MustLocalize("root.cmd.flag.help.description")) + fs.Bool("version", false, f.Localizer.MustLocalize("root.cmd.flag.version.description")) cmd.Version = version - cmd.SetVersionTemplate(f.Localizer.MustLocalize("version.cmd.outputText", localize.NewEntry("Version", build.Version))) + // cmd.SetVersionTemplate(f.Localizer.MustLocalize("version.cmd.outputText", localize.NewEntry("Version", build.Version))) pflag.CommandLine.AddGoFlagSet(flag.CommandLine) // Child commands diff --git a/pkg/localize/locales/en/cmd/root.en.en.toml b/pkg/localize/locales/en/cmd/root.en.en.toml index 1fbb2bb9f..9abaa7aa8 100644 --- a/pkg/localize/locales/en/cmd/root.en.en.toml +++ b/pkg/localize/locales/en/cmd/root.en.en.toml @@ -24,4 +24,7 @@ $ rhoas cluster connect [root.cmd.flag.help.description] one = 'Show help for a command' + +[root.cmd.flag.version.description] +one = 'Show rhoas version' \ No newline at end of file diff --git a/pkg/localize/locales/en/common.en.toml b/pkg/localize/locales/en/common.en.toml index 35126abe6..a1bf9c392 100644 --- a/pkg/localize/locales/en/common.en.toml +++ b/pkg/localize/locales/en/common.en.toml @@ -8,4 +8,7 @@ one = 'Could not save refreshed tokens to config:' one = 'unsupported operating system "{{.OS}}"' [common.log.info.updateAvailable] -one = 'A new version of rhoas is available:' \ No newline at end of file +one = 'A new version of rhoas is available:' + +[common.log.error.verboseModeHint] +one = 'Run the command in verbose mode using the -v flag to see more information' \ No newline at end of file