Skip to content

Commit

Permalink
fix: range selection (#1487)
Browse files Browse the repository at this point in the history
  • Loading branch information
71zenith authored Feb 26, 2025
1 parent 709db81 commit e48843b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions ani-cli
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

version_number="4.9.7"
version_number="4.9.8"

# UI

Expand All @@ -23,7 +23,14 @@ nth() {
multi_flag=""
[ $# -ne 1 ] && shift && multi_flag="$1"
line=$(printf "%s" "$stdin" | cut -f1,3 | tr '\t' ' ' | launcher "$multi_flag" "$prompt" | cut -d " " -f 1)
[ -n "$line" ] && printf "%s" "$stdin" | grep -E '^'"${line}"'($|[[:space:]])' | cut -f2,3 || exit 1
line_start=$(printf "%s" "$line" | head -n1)
line_end=$(printf "%s" "$line" | tail -n1)
[ -n "$line" ] || exit 1
if [ -z "$multi_flag" ]; then
printf "%s" "$stdin" | grep -E '^'"${line}"'($|[[:space:]])' | cut -f2,3 || exit 1
else
printf "%s" "$stdin" | sed -n '/^'"${line_start}"'$/,/^'"${line_end}$"'/p' || exit 1
fi
}

die() {
Expand Down

0 comments on commit e48843b

Please sign in to comment.