charmbracelet / skate

A personal key value store 🛼
MIT License
1.3k stars 23 forks source link

Skate and charm/kv duplicate code #31

Open toby opened 2 years ago

toby commented 2 years ago

Skate and the charm kv command are currently nearly copy and paste clones of each other. This makes it hard to keep them in sync and is generally not a great idea. We should make a module that has all of the Cobra CLI code in one place and use it for both skate and charm kv. It probably makes sense to have that be a submodule of Skate that gets imported in the main.go for Skate and Charm.

mishrasidhant commented 1 month ago

I've taken a crack at implementing these changes. As it currently stands both commands aren't 100% identical, specifically the list-db and delete-db sub-commands are not available for charm kv.

If we wish to keep it that way I can break the module out into just the overlapping sub commands and keep the db sub commands in skate only.

Otherwise the changes (in charm) would then include the addition of list-db and delete-db.

Not sure if this issue is the appropriate place to have these discussions. I can also put up a draft PR to showcase the changes in code if required, it's ready @toby