mirror of
https://github.com/roosta/tmux-fuzzback.git
synced 2026-09-10 07:36:29 -04:00
Move tac/tail logic to function to avoid eval
This commit is contained in:
parent
5a87af7c08
commit
cfb76b9a0b
|
|
@ -38,6 +38,14 @@ fzf_popup_cmd() {
|
|||
--print-query
|
||||
}
|
||||
|
||||
rev_cmd() {
|
||||
if cmd_exists tac;then
|
||||
tac
|
||||
else
|
||||
tail -r
|
||||
fi
|
||||
}
|
||||
|
||||
cursor_up() {
|
||||
local line_number
|
||||
line_number="$1"
|
||||
|
|
@ -212,7 +220,7 @@ create_head_file() {
|
|||
head_filename="$(get_head_filename)"
|
||||
capture_filename="$(get_capture_filename)"
|
||||
head -n "$head_n" < "$capture_filename" \
|
||||
| eval "$REV_CMD" \
|
||||
| rev_cmd \
|
||||
| nl -b 'a' -s ':' \
|
||||
| sed 's/^/1:/' \
|
||||
| sed '1s/$/[m/' \
|
||||
|
|
@ -232,7 +240,7 @@ create_tail_file() {
|
|||
echo "$trimmed" > "$tail_filename"
|
||||
else
|
||||
nl -b 'a' -s ':' < "$tmp_filename" \
|
||||
| eval "$REV_CMD" \
|
||||
| rev_cmd \
|
||||
| sed 's/^/-1:/' \
|
||||
| sed 's/$/[m/' \
|
||||
> "$tail_filename"
|
||||
|
|
|
|||
|
|
@ -10,12 +10,6 @@ if cmd_exists gawk; then
|
|||
AWK_CMD='gawk'
|
||||
fi
|
||||
|
||||
REV_CMD="tac"
|
||||
if ! cmd_exists tac; then
|
||||
REV_CMD="tail -r"
|
||||
fi
|
||||
|
||||
|
||||
# returns a string unique to current pane
|
||||
# sed removes `$` sign because `session_id` contains is
|
||||
_pane_unique_id() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue