restish
restish copied to clipboard
API management
It would be handy to have additional API management functionality. Currently, only the api configure
subcommand is available. Useful additions would be:
-
api delete
-
api show
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.
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