restish icon indicating copy to clipboard operation
restish copied to clipboard

API management

Open ilveroluca opened this issue 3 years ago • 2 comments

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

ilveroluca avatar Jul 07 '21 12:07 ilveroluca

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 avatar Mar 20 '23 19:03 lalmeras

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

lalmeras avatar Mar 21 '23 21:03 lalmeras