feat: add api command#1457
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1457 +/- ##
==========================================
- Coverage 72.89% 72.68% -0.22%
==========================================
Files 300 301 +1
Lines 11127 11173 +46
==========================================
+ Hits 8111 8121 +10
- Misses 2118 2154 +36
Partials 898 898
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| var ApiCmd = base.Cmd{ | ||
| BaseCobraCommand: func(client hcapi2.Client) *cobra.Command { | ||
| cmd := &cobra.Command{ | ||
| Use: "api [options] <path>", |
There was a problem hiding this comment.
Not sure if this is relevant for the first iteration, but what about setting Content-Type and defaulting to json?
edit: we already set this in hcloud-go, so we would not need to default here.
| return err | ||
| } | ||
|
|
||
| cmd.Print(string(respBody)) |
There was a problem hiding this comment.
Should we do pretty print with indents, or have it as an option?
There was a problem hiding this comment.
You could pipe the output to jq for pretty printing. Not sure if we need to implement this functionality in the CLI
|
We also need to think about how to handle switching between the |
This PR adds a command that allows users to directly interact with the API.
Closes #1448