Skip to content

feat: Create an --output/-o flag for JSON or plain text responses#195

Merged
dbolson merged 4 commits into
mainfrom
sc-241065/output-flag
Apr 23, 2024
Merged

feat: Create an --output/-o flag for JSON or plain text responses#195
dbolson merged 4 commits into
mainfrom
sc-241065/output-flag

Conversation

@dbolson
Copy link
Copy Markdown
Contributor

@dbolson dbolson commented Apr 22, 2024

Adds an optional --output/-o flag to set the output of a command. We'll use this to return either JSON or plain text when an command has output.

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.

@dbolson
Copy link
Copy Markdown
Contributor Author

dbolson commented Apr 22, 2024

@k3llymariee I added another commit for output flag error handling. Could you review again?

}
}

func CmdError(err error, commandPath string) error {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

not related to this change but in getCommandPath we have stripe hardcoded still 😅

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

We should remove this reference haha

dbolson and others added 2 commits April 23, 2024 11:24
* Use output flag to show JSON or plaintext

* Call outputter in command handler

* Backfill test

* Rename

* Refactor to pass in fn instead of interface

* Remove stripe code

* Create additional interface

* Implement plaintext for multiple resource response (#199)
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