mirror of
https://github.com/pystardust/ani-cli.git
synced 2026-02-20 07:01:47 +08:00
fix: range selection (#1487)
This commit is contained in:
parent
709db81d4b
commit
e48843b2de
11
ani-cli
11
ani-cli
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
version_number="4.9.7"
|
||||
version_number="4.9.8"
|
||||
|
||||
# UI
|
||||
|
||||
@ -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() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user