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: config feedback #292

Merged
merged 4 commits into from
May 15, 2024
Merged

feat: config feedback #292

merged 4 commits into from
May 15, 2024

Conversation

dbolson
Copy link
Contributor

@dbolson dbolson commented May 15, 2024

Show success/error message after setting/unsetting a config value.

$ ldcli config --set environment production --set project default
Successfully updated
* environment
* project

$ ldcli config --set environment production --set project default --output json
{"items":["environment","project"]}

$ ldcli config --set invalid production
invalid is not a valid configuration option

$ ldcli config --set invalid production --output json
{"message":"invalid is not a valid configuration option"}

$ ldcli config --unset project
Successfully deleted project

$ ldcli config --unset project --output json
{"key":"project"}

$ ldcli config --unset invalid
invalid is not a valid configuration option

$ ldcli config --unset invalid --output json
{"message":"invalid is not a valid configuration option"}

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.

@@ -305,3 +319,33 @@ func writeAlphabetizedFlags(sb *strings.Builder) {
sb.WriteString(fmt.Sprintf("- `%s`: %s\n", flag, cliflags.AllFlagsHelp()[flag]))
}
}

func outputSetAction(newFields []string) (string, error) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These functions create JSON to pass into the output function since it expects an API response.

@dbolson dbolson requested a review from k3llymariee May 15, 2024 23:22
@dbolson dbolson enabled auto-merge (squash) May 15, 2024 23:32
Key: newField,
}
fieldJSON, _ := json.Marshal(field)
output, err := output.CmdOutput("delete", viper.GetString(cliflags.OutputFlag), fieldJSON)
Copy link
Contributor

Choose a reason for hiding this comment

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

i know we are deleting it from the config but Successfully deleted project feels a bit jarring here, especially in the context of resources like flags/projects/environments.

@dbolson dbolson merged commit 0268ab6 into main May 15, 2024
2 checks passed
@dbolson dbolson deleted the sc-242493/config-feedback branch May 15, 2024 23:47
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