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

feat: expanded help for credentials command #120

Merged
merged 1 commit into from
Dec 4, 2020
Merged
Changes from all 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
20 changes: 16 additions & 4 deletions pkg/cmd/kafka/credentials/credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,32 @@ import (
var outputFlagValue string
var force bool

// NewGetCommand gets a new command for getting kafkas.
// NewCredentialsCommand gets a new command for
// generating credentials to connect to your Kafka cluster
func NewCredentialsCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "credentials",
Short: "Generate credentials to connect to your cluster",
Long: "Generate credentials to connect your application to the Kafka cluster",
Long: heredoc.Doc(`
Generate SASL/PLAIN credentials to connect your application to the Kafka cluster.
The credentials are saved to an output format of your choice from the list below with the --output flag:

- env (default): Saves the credentials to a .env file as environment variables
- kafka, properties: Saves the cluster credentials to a kafka.properties file
- json: Saves the cluster credentials in a credentials.json JSON file
`),
Example: heredoc.Doc(`
$ rhoas kafka credentials
$ rhoas kafka describe --id=1iSY6RQ3JKI8Q0OTmjQFd3ocFRg`,
$ rhoas kafka credentials --force
$ rhoas kafka credentials --output kafka
$ rhoas kafka credentials --output=env
$ rhoas kafka credentials -o=properties
$ rhoas kafka credentials -o json`,
),
Run: runCredentials,
}
cmd.Flags().StringVarP(&outputFlagValue, "output", "o", "env", "Format of the config [env, kafka, properties, json]")
cmd.Flags().BoolVarP(&force, "force", "f", false, "Force overwrite existing files")
cmd.Flags().BoolVarP(&force, "force", "f", false, "Force overwrite a file if it already exists")
return cmd
}

Expand Down