mirror of
https://github.com/edu4rdshl/based.fish.git
synced 2026-07-17 23:24:46 +00:00
(feat): show the last command on top per-directory
This commit is contained in:
parent
f1695694ed
commit
d7c44fae63
1 changed files with 3 additions and 1 deletions
|
|
@ -44,10 +44,12 @@ function __based
|
||||||
else
|
else
|
||||||
set -f results (sqlite3 -batch $db "
|
set -f results (sqlite3 -batch $db "
|
||||||
SELECT DISTINCT cmd FROM (
|
SELECT DISTINCT cmd FROM (
|
||||||
-- Get the most recent command across all paths
|
-- Get the most recent command across the current path to emulate the normal history behavior
|
||||||
|
-- This ensures that the most recent command is always at the top
|
||||||
SELECT cmd, max_ts, counter, priority FROM (
|
SELECT cmd, max_ts, counter, priority FROM (
|
||||||
SELECT cmd, MAX(ts) as max_ts, MAX(counter) as counter, 0 as priority
|
SELECT cmd, MAX(ts) as max_ts, MAX(counter) as counter, 0 as priority
|
||||||
FROM log
|
FROM log
|
||||||
|
WHERE path = '$path'
|
||||||
GROUP BY cmd
|
GROUP BY cmd
|
||||||
ORDER BY max_ts DESC
|
ORDER BY max_ts DESC
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue