blob: e576a7b25a4e5c54dcb439e1d20e13ef8e1a4224 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#!/bin/sh
index()
{
if [ -t 2 ]
then
nl -nln -v0 \
| eval fzf --with-nth=2 $OSEL_TERM_FLAGS \
| cut -f1 -d' '
else
eval fuzzel -d --index $OSEL_GUI_FLAGS
fi
}
normal()
{
if [ -t 2 ]
then
eval fzf $OSEL_TERM_FLAGS
else
eval fuzzel -d $OSEL_GUI_FLAGS
fi
}
f=normal
while getopts 'i' opt
do
case $opt in
i)
f=index
;;
*)
echo "Usage: osel [-i]" >&2
exit 1
esac
done
x="$($f)"
[ -z "$x" ] && exit 1
printf '%s' "$x"
|