Skip to content

Commit

Permalink
[fix] Uniformize CLI help commands/flags descriptions (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
qboileau authored Apr 12, 2024
1 parent d4c032d commit 06aba51
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 15 deletions.
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,29 @@ CDK_TOKEN=<admin-token>

### Commands Usage
````
You need to define the CDK_TOKEN and CDK_BASE_URL environment variables to use this tool.
You can also use the CDK_KEY,CDK_CERT instead of --key and --cert flags to use a certificate for tls authentication.
If you have an untrusted certificate you can use the CDK_INSECURE=true variable to disable tls verification
Usage:
conduktor [flags]
conduktor [command]
Available Commands:
apply Upsert a resource on Conduktor
completion Generate the autocompletion script for the specified shell
delete Delete resource of a given kind and name
get Get resource of a given kind
help Help about any command
version Display the version of conduktor
Flags:
-h, --help Help for conduktor
-v, --verbose Show more information for debugging
--cert string set pem cert for certificate authentication (useful for teleport)
-h, --help help for conduktor
--key string set pem key for certificate authentication (useful for teleport)
-v, --verbose show more information for debugging
Use "conduktor [command] --help" for more information about a command.
````

You can find more usage details on our [documentation](https://docs.conduktor.io/platform/reference/cli-reference/)
Expand Down
8 changes: 4 additions & 4 deletions cmd/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var dryRun *bool
// applyCmd represents the apply command
var applyCmd = &cobra.Command{
Use: "apply",
Short: "upsert a resource on Conduktor",
Short: "Upsert a resource on Conduktor",
Long: ``,
Run: func(cmd *cobra.Command, args []string) {
var resources = make([]resource.Resource, 0)
Expand All @@ -30,13 +30,13 @@ var applyCmd = &cobra.Command{
upsertResult, err := apiClient.Apply(&resource, *dryRun)
if err != nil {
fmt.Fprintf(os.Stderr, "Could not apply resource %s/%s: %s\n", resource.Kind, resource.Name, err)
allSuccess = false
allSuccess = false
} else {
fmt.Printf("%s/%s: %s\n", resource.Kind, resource.Name, upsertResult)
}
}
if(!allSuccess) {
os.Exit(1)
if !allSuccess {
os.Exit(1)
}
},
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
// applyCmd represents the apply command
var deleteCmd = &cobra.Command{
Use: "delete",
Short: "delete resource of a given kind and name",
Short: "Delete resource of a given kind and name",
Long: ``,
Args: cobra.ExactArgs(2),
Run: func(cmd *cobra.Command, args []string) {
Expand Down
6 changes: 3 additions & 3 deletions cmd/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

var getCmd = &cobra.Command{
Use: "get",
Short: "get resource of a given kind",
Short: "Get resource of a given kind",
Args: cobra.NoArgs,
Run: func(cmd *cobra.Command, args []string) {
// Root command does nothing
Expand All @@ -19,7 +19,7 @@ var getCmd = &cobra.Command{

var getCmdWhenNoSchema = &cobra.Command{
Use: "get kind [name]",
Short: "get resource of a given kind",
Short: "Get resource of a given kind",
Long: `If name not provided it will list all resource. For example:
conduktor get application
will list all applications. Whereas:
Expand Down Expand Up @@ -56,7 +56,7 @@ func initGet() {
for _, tag := range tags {
tagCmd := &cobra.Command{
Use: fmt.Sprintf("%s [name]", tag),
Short: "get resource of kind " + tag,
Short: "Get resource of kind " + tag,
Args: cobra.MatchAll(cobra.MaximumNArgs(1)),
Long: `If name not provided it will list all resource`,
Run: func(cmd *cobra.Command, args []string) {
Expand Down
8 changes: 4 additions & 4 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var schemaClient *schema.Schema = nil
// rootCmd represents the base command when called without any subcommands
var rootCmd = &cobra.Command{
Use: "conduktor",
Short: "command line tools for conduktor",
Short: "Command line tools for conduktor",
Long: `You need to define the CDK_TOKEN and CDK_BASE_URL environment variables to use this tool.
You can also use the CDK_KEY,CDK_CERT instead of --key and --cert flags to use a certificate for tls authentication.
If you have an untrusted certificate you can use the CDK_INSECURE=true variable to disable tls verification`,
Expand Down Expand Up @@ -53,9 +53,9 @@ func init() {
if err != nil {
fmt.Fprintf(os.Stderr, "Could not load server openapi: %s\n", err)
}
debug = rootCmd.PersistentFlags().BoolP("verbose", "v", false, "Show more information for debugging")
key = rootCmd.PersistentFlags().String("key", "", "Set pem key for certificate authentication (useful for teleport)")
cert = rootCmd.PersistentFlags().String("cert", "", "Set pem cert for certificate authentication (useful for teleport)")
debug = rootCmd.PersistentFlags().BoolP("verbose", "v", false, "show more information for debugging")
key = rootCmd.PersistentFlags().String("key", "", "set pem key for certificate authentication (useful for teleport)")
cert = rootCmd.PersistentFlags().String("cert", "", "set pem cert for certificate authentication (useful for teleport)")
initGet()
initDelete()
initApply()
Expand Down
2 changes: 1 addition & 1 deletion cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var hash = "unknown"
// versionCmd represents the apply command
var versionCmd = &cobra.Command{
Use: "version",
Short: "display the version of conduktor",
Short: "Display the version of conduktor",
Long: ``,
Run: func(cmd *cobra.Command, args []string) {
fmt.Printf("Version: %s\nHash: %s\n", version, hash)
Expand Down

0 comments on commit 06aba51

Please sign in to comment.