Commit Graph

47 Commits

Author SHA1 Message Date
Albert S. e1375f237c Consider return code when checking if command was already printed 2022-09-27 17:01:20 +02:00
Albert S. ac9aab63bd Change 'timestamp' to simple unix epoch
Subjectively, 6d4e7a96dc increases
lag on a years-old production database with ~240k entries when searching
with CTRL+R.

So change timestamp column from datetime type (which is a string)
to integer, storing unix epoch now. As we deal with those primarily,
we also avoid conversions now.

Mentioned database shrinks by 2MB compared to previously (both VACCUMed)...

DROP unused count_by_date VIEW.
2021-09-28 18:27:39 +02:00
Albert S. d0e07640e8 Update README.md 2021-09-25 13:40:34 +02:00
Albert S. 6d4e7a96dc Implement --today
Also assign timestamp to HistoryEntry during search

Closes: #3
2021-09-25 12:49:50 +02:00
Albert S. ebcdfa5ff4 Print failed commands in red.
Optimized for dark terminals :-).

Closes: #8
2021-09-25 12:14:07 +02:00
Albert S. 0949ee422a Implement mode for reverse search in cwd
Add a mode selection mode to liner.

Add modes to search globally or in the cwd.
2021-09-25 11:52:39 +02:00
Albert S. 3a6a1b2aa9 bash-ctrlr: Improve reverse bash search performance
Remove hack that only starts searching when two chars have been entered

Improve performance by adding LIMIT clause instead.
2021-08-19 21:33:01 +02:00
Albert S. 1a6c75cea9 Improve README.md 2021-08-08 13:24:30 +02:00
Albert S. bb2450b8ec history: Only start search when at least 2 chars have been entered
Starting search with the first character leads to a noticable delay.
This hack ensures a more pleasant experience.
2021-08-08 12:38:25 +02:00
lawl 67050d32b9 Implement bash CTRL-R reverse history
Fork customized liner into own repo bash.
Rename -being and -end options to -after and -before.
2021-08-08 11:40:33 +02:00
Albert S. 33183dd7d3 Begin liner integration 2021-08-08 11:40:33 +02:00
lawl a8f35951f1 Replace previous PROMPT_COMMAND in bashrc with more convenient option 2021-06-05 15:42:33 +02:00
lawl b9e3a3629b Fix bug in cwd search and fix go-staticcheck regexp complaint 2021-06-05 15:05:18 +02:00
lawl 16752411e1 Add 'nolog' subcommand
The nolog subcommand instructs the user on how to disable logging
for the current shell. This is not (easily) doable automatically
since we can't affect a parent's environment without insane hacks.

Fixes #4
2021-06-05 14:49:25 +02:00
lawl c480519fca Resolve CWD arguments as absolute path
Previously when calling e.g 'hs9001 search -cwd .' we would search
for a litteral '.' in the database. Now we resolve that argument
relative to the CWD.
2021-06-05 14:28:02 +02:00
lawl 70e66f47ba CLI: Rename -workdir to -cwd so we have to type less 2021-06-05 14:27:25 +02:00
Albert S. 216e59747c Add 'version' command 2021-05-16 18:38:50 +02:00
Albert S. c206b07b2d add/search: Process cmd exit code 2021-05-16 18:01:48 +02:00
Albert S. 3b01d7b898 search: Do not print consecutive equal commands by default 2021-05-16 17:13:29 +02:00
lawl baa0d58a47 Fix a bug in DB migration 2021-04-05 14:37:37 +02:00
Albert S. 163429138c search(): Allow searching by timestamps 2021-04-05 14:22:05 +02:00
Albert S. 2af0c1d551 add(): Log current timestamp too 2021-04-05 14:21:54 +02:00
Albert S. 595595c4cb search: Allow searching for cwd 2021-04-05 13:15:20 +02:00
Albert S. 250af52750 add(): Pass HistoryEntry struct 2021-04-05 13:00:30 +02:00
Albert S. 88362e99a9 Introduce HistoryEntry struct ; refactor search and delete 2021-04-05 12:49:13 +02:00
lawl 776dcebb04 Log cwd 2021-04-05 11:54:09 +02:00
lawl 1809905992 Add DB migrations 2021-04-05 11:44:43 +02:00
lawl 305e4300cc Fix off-by-one in CLI 2021-04-05 10:43:54 +02:00
lawl b02911c9b4 Add 'delete' subcommand to delete matching records from log 2021-04-05 10:29:50 +02:00
lawl 8477ba5bfe CLI: Properly parse cli flags for subcommands
Previously we parsed cli flags globally instead of per subcommand, which was weird.
2021-04-05 10:18:35 +02:00
lawl 54697be895 Search: Properly exit on error 2021-04-05 09:53:25 +02:00
Albert S. da945dce2d add LICENSE 2021-03-23 14:35:50 +01:00
Albert S. ee7a0868a8 Update README.md: Mention repos, minor improvements 2021-03-23 14:35:50 +01:00
Albert S. e63ad28f74 Print usage also when an invalid command is supplied 2021-03-22 19:51:29 +01:00
Albert S. eb0612864d search: concat multiple arguments. Don't just use the first
This is more natural
2021-03-22 19:49:44 +01:00
lawl 31973bd5dd Use exit status 23 as a do not log code 2021-03-21 12:45:26 +01:00
Albert S. 50515b2d72 Update README 2021-03-21 10:55:49 +01:00
Albert S. c67d38482d add: Fix panic when history command returns nothing
If you disable bash history files alltogether, "history 1" will not contain
anything on first launch of a terminal and therefore the regex
has nothing to parse, so we get an out of bounds array access.
So fix this.

Though it's a dirty silent fail now, I don't want error messages/warnings
everytime I open a shell.
2021-03-21 10:43:06 +01:00
Albert S. 79a26e2aa1 databaseLocation(): Consider env variable override
Allow overriding databaseLocation by an environment variable.

Closes: #1
2021-03-21 10:38:12 +01:00
Albert S. 1d991b50fc Usage text: Mention import 2021-03-21 10:29:41 +01:00
lawl 5604c310d7 Pass DB into functions. Implement import feature 2021-03-20 20:47:05 +01:00
Albert S. 9925920e04 Update README.md 2021-03-20 20:42:35 +01:00
lawl f58c82a3ee remove commented out code 2021-03-20 20:28:03 +01:00
lawl e3e7fd74e0 Add super minimalistic readme 2021-03-20 20:27:06 +01:00
lawl a2bcc9685a Don't crash when no arguments are given 2021-03-20 20:22:38 +01:00
lawl c271bc986d Init+ minor improvements 2021-03-20 20:18:27 +01:00
Albert S. 920db7d925 First commit 2021-03-20 19:39:18 +01:00