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: Add additional help text with missing access-token #219

Merged
merged 2 commits into from
Apr 30, 2024

Conversation

dbolson
Copy link
Contributor

@dbolson dbolson commented Apr 30, 2024

When a flag that can be set in the config file is missing, show additional text to guide the user to add that flag to the config.

Without access-token set:

$ ldcli flags get
required flag(s) "access-token", "environment", "flag", "project" not set.

Use `ldcli config --set access-token <value>` to configure the value to persist across CLI commands.

See `ldcli flags get --help` for supported flags and usage.

With access-token set:

$ ldcli flags get --access-token foo
required flag(s) "environment", "flag", "project" not set. See `ldcli flags get --help` for supported flags and usage.

Requirements

  • I have added test coverage for new or changed functionality
  • I have followed the repository's pull request submission guidelines
  • I have validated my changes against all supported platform versions

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.

errorMessage := err.Error() + "."

// show additional help if a missing flag can be set in the config file
if strings.Contains(err.Error(), cliflags.AccessTokenFlag) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now we only check the access-token flag because the other ones have default values.

@dbolson dbolson requested review from k3llymariee and sunnyguduru and removed request for k3llymariee April 30, 2024 20:03
@dbolson dbolson merged commit b74053c into main Apr 30, 2024
2 checks passed
@dbolson dbolson deleted the sc-241906/config-help branch April 30, 2024 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants