summaryrefslogtreecommitdiff
path: root/dot/local/bin/xq
blob: e5077c35c4164209f760e2eb807d783246196a4f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/sh

xq()
{
    f=$(mktemp) || return
    trap 'rm -f "$f"' EXIT
    question=$1
    default=$2
    w_height=8
    w_width=50
    export f question w_height w_width default
    xterm -e 'whiptail --inputbox "$question" "$w_height" "$w_width" "$default" 2>"$f"' || return
    read line < "$f"
    printf '%s\n' "$line"
}

xq "$1" "$2"