Add -print-last-dir and -print-selection flags (#1402)

* Add `-print-last-dir` and `-print-selection` flags

* Add shell completions

* Update `lfcd.sh` example to use new flag
This commit is contained in:
Joe Lim authored and GitHub committed 2023-08-31 10:10:31 +10:00
1 parent 63d21b5a3e
commit 6aa3d2aa18
10 files changed
+50 -26

No files matched your search

+1 -11
View File
@@ -15,16 +15,6 @@
#
lfcd () {
tmp="$(mktemp)"
# `command` is needed in case `lfcd` is aliased to `lf`
command lf -last-dir-path="$tmp" "$@"
if [ -f "$tmp" ]; then
dir="$(cat "$tmp")"
rm -f "$tmp"
if [ -d "$dir" ]; then
if [ "$dir" != "$(pwd)" ]; then
cd "$dir"
fi
fi
fi
cd "$(command lf -print-last-dir "$@")"
}