feat: Add valid config fields to its help#217
Conversation
| The LaunchDarkly CLI allows you to save preferred settings, either within a config file using the `config` commands, or set as environment variables. | ||
|
|
||
| Current respected settings: | ||
| Current settings: |
There was a problem hiding this comment.
Updated the readme to be consistent with the config help output.
There was a problem hiding this comment.
How about:
| Current settings: | |
| Supported settings: |
?
| } | ||
|
|
||
| helpFun := cmd.HelpFunc() | ||
| cmd.SetHelpFunc(func(cmd *cobra.Command, args []string) { |
There was a problem hiding this comment.
This runs the existing help fn after updating the command's Long value.
| ProjectFlag = "project" | ||
| RoleFlag = "role" | ||
|
|
||
| AccessTokenFlagDescription = "LaunchDarkly access token with write-level access" |
There was a problem hiding this comment.
Moved these to constants to remove duplication.
| cmd.SetHelpFunc(func(cmd *cobra.Command, args []string) { | ||
| var sb strings.Builder | ||
| sb.WriteString("\n\nCurrent settings:\n") | ||
| for _, s := range []string{ |
There was a problem hiding this comment.
This uses a slice to preserve order since a map doesn't.
| The LaunchDarkly CLI allows you to save preferred settings, either within a config file using the `config` commands, or set as environment variables. | ||
|
|
||
| Current respected settings: | ||
| Current settings: |
There was a problem hiding this comment.
How about:
| Current settings: | |
| Supported settings: |
?
|
|
||
| * `access-token` A LaunchDarkly API token with write-level access | ||
| * `access-token` A LaunchDarkly access token with write-level access | ||
| * `analytics-optout` Opt out of analytics tracking (default false) |
There was a problem hiding this comment.
| * `analytics-optout` Opt out of analytics tracking (default false) | |
| * `analytics-opt-out` Opt out of analytics tracking (default false) |
| helpFun := cmd.HelpFunc() | ||
| cmd.SetHelpFunc(func(cmd *cobra.Command, args []string) { | ||
| var sb strings.Builder | ||
| sb.WriteString("\n\nCurrent settings:\n") |
There was a problem hiding this comment.
How about:
| sb.WriteString("\n\nCurrent settings:\n") | |
| sb.WriteString("\n\nSupported settings:\n") |
?
| @@ -10,7 +16,7 @@ Flags: | |||
| --unset string Unset a config field | |||
There was a problem hiding this comment.
Minor (and I know, I'm tagging this on a test file) but I noticed that --unset is marked as taking a string parameter whereas --set isn't marked to have any parameter. It should also have string.
There was a problem hiding this comment.
Running
ldcli config --helpshowsRequirements
Related issues
Provide links to any issues in this repository or elsewhere relating to this pull request.
Describe the solution you've provided
Provide a clear and concise description of what you expect to happen.
Describe alternatives you've considered
Provide a clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context about the pull request here.