#!/bin/sh help() { tofi --help cat <<-EOF Extra options: -b alias for '--anchor=bottom' -i ignored, exists for compatibility -l alias for '--horizontal=false --height='. Note: height is a rough approximation, the actual number of lines shown may slightly differ. -m alias for '--output=' -p alias for '--prompt-text=' -h, --help Show this help EOF } if ! opts="$(getopt -o bil:m:p:h -l help -n "$SCRIPT" -- "$@")"; then help exit 1 fi eval set -- "$opts" args="" while true; do case "$1" in -h | --help) help exit 0 ;; -b) args="$args --anchor=bottom" shift ;; -l) args="$args --result-spacing=0 --horizontal=false --height=$((30 + 23 * $2))" shift 2 ;; -m) args="$args --output=$2" shift 2 ;; -p) args="$args --prompt-text=$2" shift 2 ;; -i) shift ;; --) shift break ;; *) args="$args $1" shift ;; esac done set -- "$args" "$@" # shellcheck disable=2068 command tofi $@