From 44619beaa6a5125aa87a08bf4a7ef3f27b29b2bf Mon Sep 17 00:00:00 2001 From: sammyette Date: Fri, 14 Apr 2023 00:15:34 -0400 Subject: [PATCH] feat: show indexes on cdr list and change home to tilde --- CHANGELOG.md | 1 + nature/commands/cdr.lua | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8330f41..c3a2c66 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - `read()` method for retrieving input (so now the `in` sink of commanders is useful) - `flush()` and `autoFlush()` related to flushing outputs - `pipe` property to check if a sink with input is a pipe (like stdin) +- Show indexes on cdr list ### Fixed - Replaced `sed` in-place editing with `grep` and `mv` for compatibility with BSD utils diff --git a/nature/commands/cdr.lua b/nature/commands/cdr.lua index 288ae22..321db0e 100644 --- a/nature/commands/cdr.lua +++ b/nature/commands/cdr.lua @@ -20,7 +20,10 @@ to get a list of recent directories, use {green}{underline}cdr list{reset}]]) sinks.out:writeln 'No directories have been visited.' return 1 end - sinks.out:writeln(table.concat(recentDirs, '\n')) + for idx, d in ipairs(dirs.recentDirs) do + if d:find(hilbish.home, 1, true) then d = fs.join('~', d:sub(hilbish.home:len() + 1)) end + sinks.out:writeln(lunacolors.format(string.format('{cyan}%d{reset} %s', idx, d))) + end return end