cantino / mcfly

Fly through your shell history. Great Scott!
MIT License
6.78k stars 177 forks source link

Combine the mcfly databases on different machines. #189

Open hongyi-zhao opened 2 years ago

hongyi-zhao commented 2 years ago

Assuming I run mcfly on multiple machines, one mcfly database file will be generated on each machine. So, the problem is how to combine these mcfly databases into one.

Regards, HY

cantino commented 2 years ago

They're SQLite databases so you'd need to merge each of their tables. This would take a bit of code, but should work.

hongyi-zhao commented 2 years ago

Why not implement the corresponding option in mcfly?

cantino commented 2 years ago

How would you envision that option working?

Alternatively, you could try synchronizing the database using something like Dropbox or Syncthing?

hongyi-zhao commented 2 years ago

How would you envision that option working?

Just an idea, no specific scenario.

Alternatively, you could try synchronizing the database using something like Dropbox or Syncthing?

Do you mean to use a centralized cloud storage workflow?

cantino commented 2 years ago

Now that I think about it, Dropbox wouldn't work because the database would always conflict. I'm not sure what a clean way would be to support streams from multiple machines besides having a merge tool, or maybe allowing it to read from multiple DBs that are then synced. I think this is out of scope for this project, though.

deini commented 2 years ago

What about git + a merge driver like the one https://github.com/larkery/zsh-histdb uses?

nicoandmee commented 2 years ago

I think this also would be a super useful feature, I've wasted multiple hours today trying to import another mcfly history.

cantino commented 2 years ago

I'm open to contributions of a merge tool, or an ENV variable that lists multiple DBs to read from.