cantino / mcfly

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

Support for per-directory-history? #267

Open ToontjeM opened 2 years ago

ToontjeM commented 2 years ago

Would it be possible have support for https://github.com/jimhester/per-directory-history in McFly?

ToontjeM commented 2 years ago

Ah, i guess not, since "McFly stores its SQLite database in the standard location for the OS."

jankatins commented 1 year ago

This should be doable: There is https://github.com/ddworken/hishtory which stores per directory in a sqllite db:

hishtory is a better shell history. It stores your shell history in context (what directory you ran the command in, whether it succeeded or failed, how long it took, etc). This is all stored locally and end-to-end encrypted for syncing to to all your other computers. All of this is easily queryable via the hishtory CLI. This means from your laptop, you can easily find that complex bash pipeline you wrote on your server, and see the context in which you ran it. ... For true power users, you can even query in SQLite via sqlite3 -cmd 'PRAGMA journal_mode = WAL' ~/.hishtory/.hishtory.db.

mbrav commented 1 year ago

As a long time user of mcfly, I just realized how useful this feature would be. It should not be hard to implement, just add another table in the SQLite database that keeps track of the current directory, a couple code additions and voila. I might consider picking this up as a side project and see I can get a viable PR. I really enjoy using mcfly and install it virtually on all Linux installations I interact with.

Update: Upon further investigation, I realized that the per-directory history can be toggled by pressing the F3 key:

Screenshot_0308

Don't know if this relates to the issue, but this certainly is the functionality I was looking for.