blob: 653fa1f4cf113b72ad296b74f233e47d87be6d58 (
plain)
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
|
#!/usr/bin/env bash
program="${1:-$(dmenu_path | dmenu -l 4 -g 5)}"
opfil="/tmp/dmh_options.txt"
test -z "${program}" && exit 1
if ${program} --help > "${opfil}"
then
option="$(\
grep -E "^ *-[-a-Z]* " "${opfil}" \
| tr -s ' ' \
| sort | uniq \
| column -l 2 -t \
| dmenu -x -l 20 -g 1 -p "${program}" \
| awk '{print $1}' \
)"
elif man $program > "${opfil}"
then
echo lesgo
else
echo "No options found for '${program}'" > /dev/stderr
exit 1
fi
test -z "${option}" && exit 1
rm -f "${opfil}"
${program} ${option}
|