We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 72b59b6 commit ce5cd71Copy full SHA for ce5cd71
1 file changed
mus
@@ -38,7 +38,11 @@ _mus_find() {
38
(( ! $#fs )) && fs=(${(@f)"$(_ffind "$dir"/ -${cs-i}path "*$1*")"})
39
40
while (( $#fs > 1 )) && [[ ! -v list ]]; do
41
- for f in $fs; do >&2 echo ${f#"$dir"/}; done
+ local i=1
42
+ for f in $fs; do
43
+ >&2 echo $i. ${f#"$dir"/}
44
+ i=$((i + 1))
45
+ done
46
47
>&2 echo
48
>&2 read REPLY?"Which one? [s"
@@ -48,7 +52,13 @@ _mus_find() {
52
case "$REPLY" in
49
53
all|) break ;;
50
54
q) return ;;
51
- *) fs=(${(M)fs:#*(#l)$REPLY*}) ;;
55
+ *) # The pattern <-> is zsh-ism which matches any string
56
+ # having any number of digits and only digits.
57
+ if [[ "$REPLY" = <-> ]]; then
58
+ fs=("${fs[$REPLY]}")
59
+ else
60
+ fs=(${(M)fs:#*(#l)$REPLY*})
61
+ fi ;;
62
esac
63
done
64
0 commit comments