#!/bin/sh OSEL_GUI_FLAGS="-d --log-level=warning $OSEL_GUI_FLAGS" index() { if [ -t 2 ] then nl -nln -w1 \ | eval fzf --with-nth=2.. $OSEL_TERM_FLAGS \ | cut -f1 else eval fuzzel --index $OSEL_GUI_FLAGS \ | xargs expr 1 + fi } normal() { if [ -t 2 ] then eval fzf $OSEL_TERM_FLAGS else eval fuzzel $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"