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: output flag all commands #201

Merged
merged 8 commits into from
Apr 24, 2024
Merged

Conversation

dbolson
Copy link
Contributor

@dbolson dbolson commented Apr 23, 2024

Sets up support for the output flag for all endpoints except config (for now).

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.

Copy link
Contributor Author

@dbolson dbolson left a comment

Choose a reason for hiding this comment

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

This is the same pattern repeated:

  • add the outputter to a command handler
  • update tests to make sure it's called with a JSON response and returns the JSON

@@ -74,7 +75,15 @@ func runCreate(client flags.Client) func(*cobra.Command, []string) error {
return err
}

fmt.Fprintf(cmd.OutOrStdout(), string(response)+"\n")
output, err := output.CmdOutput(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@k3llymariee At some point for the dynamic endpoint function, we'll need a field that defines which function to call for each action.

@dbolson dbolson requested review from sunnyguduru and k3llymariee and removed request for sunnyguduru April 23, 2024 20:53
* Show plaintext response for config --list

* Use map for output type

* Refactor types

* Organization

* Remove extra type

* feat: output flag errors (#204)

* Add plain text error handling

* Output flag errors as plain text or JSON

* Remove unused code

* Update all commands to return plaintext or JSON

* Refactor outputter

* Backfill tests

* Reorganize

* Refactor

* Remove comments

* Renamed functions
@dbolson dbolson changed the title feat: output flag all endpoints feat: output flag all commands Apr 24, 2024
@dbolson dbolson merged commit 1670cae into main Apr 24, 2024
3 checks passed
@dbolson dbolson deleted the sc-241065/output-flag-all-endpoints branch April 24, 2024 21:34
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.

3 participants