3 ms·
Shameless plug, my version of YABHA (yet another bash history app): https://github.com/andmarios/bashistdb https://github.com/andmarios/bashistdb Written in go
by andmarios 10y ago
Shameless plug, my version of YABHA (yet another bash history app):
https://github.com/andmarios/bashistdb https://github.com/andmarios/bashistdb
Written in go, uses sqlite and can work locally or remotely. In the latter case you can send history from many accounts and search globally. Transport encryption is based on NaCl. One binary serves all roles.
Doesn't store other information than command line and time but this is what I need most of time.
The main pain point behind its creation was searching in history. There is a global flag (search in all accounts, -g), the wild card is SQL's wild card (%). Less frequently used but very helpful, content search (-A, -B, -C, like grep). Also regexp is supported though very rarely is needed.
- inetknght 10y agotbqh, I would like to see regexp be default in more situations. It's handy and important to learn for personal growth and setting it as a default would passive-aggressively try to encourage more novices to learn it.
- andmarios 10y agoRegexp search is slower. SQLite's support for regexp comes from an external library (sqlite3-pcre) that most of the time isn't installed on the host system. Even when it is, it doesn't always work. My solution around this, is, when regexp is enabled, to query for all the history and then have Go perform the regexp search itself —the normal is to let SQLite perform the search. Depending on your CPU and history size, you may need a couple seconds for the result. For example when the server process runs on an Atom processor and the history is about 150.000 lines long, a regexp search takes about 7 seconds. A normal search with a wildcard on the same machine and history database, needs only 1 second.
- inetknght 10y agoIf it's slower, then use a simpler query or come up with a way to improve the back-end search speed (which you did, it looks like). My point is that novice developers don't usually work with that size of data. And if they are working with that size of data, then both regex and performance are good things for them to learn :)