danielgtaylor / restish

Restish is a CLI for interacting with REST-ish HTTP APIs with some nice features built-in
https://rest.sh/
MIT License
900 stars 74 forks source link

API management #53

Open ilveroluca opened 3 years ago

ilveroluca commented 3 years ago

It would be handy to have additional API management functionality. Currently, only the api configure subcommand is available. Useful additions would be:

lalmeras commented 1 year ago

It appears that show command is implemented in 0.17.0.

I look into delete implementation, and it cannot be implemented simply as viper is used to manage configuration and does not support configuration key unset: see https://github.com/spf13/viper/issues/632. As viper issue does not seem to be updated for a long time, the most straightforward solution is to perform deletion with a custom json unmarshal/marshal call.

lalmeras commented 1 year ago

Here is a basic implementation using json.MarshallIndent. Not sure it is the better way to perform this as it updates configuration file outside viper API, but as highlighted sooner viper override-based behavior is not compatible with configuration key removal.

https://github.com/danielgtaylor/restish/compare/main...lalmeras:restish:command-api-delete?expand=1