summaryrefslogtreecommitdiff
path: root/bin/menuscripts/mhelp
diff options
context:
space:
mode:
authorRaymaekers Luca <raymaekers.luca@gmail.com>2023-08-30 08:23:45 +0200
committerRaymaekers Luca <raymaekers.luca@gmail.com>2023-08-30 08:23:45 +0200
commit3f8594ee04d2a3d9b40a259daf3b564a53b510fa (patch)
tree66ed50643cdc81af813b5771a99732d0f78bb618 /bin/menuscripts/mhelp
parent45d39ae0c67bb086f4df0c366b251e06c888408d (diff)
parent333aaf38c66a1e4ba41d3acea38b21613c0075b2 (diff)
Merge branch 'main' of db:dotfiles
Diffstat (limited to 'bin/menuscripts/mhelp')
-rwxr-xr-xbin/menuscripts/mhelp39
1 files changed, 12 insertions, 27 deletions
diff --git a/bin/menuscripts/mhelp b/bin/menuscripts/mhelp
index e03222b..339d6bf 100755
--- a/bin/menuscripts/mhelp
+++ b/bin/menuscripts/mhelp
@@ -1,33 +1,18 @@
#!/usr/bin/env sh
-OPTIONS="/tmp/dmh_options.txt"
-if [ "$MENUCMD" = "tofi" ]
-then
- program="$(tofi-run --prompt-text "program: ")"
- menucmd="tofi --width 50% --height 30% --matching-algorithm normal --prompt-text $program:"
-elif [ "$MENUCMD" = "dmenu" ]
-then
- program="$(dmenu_path | dmenu -l 4 -g 5 -p "program:")"
- menucmd="dmenu -l 20 -g 1 -x -i -p $program:"
-else
- program="$(dmenu_path | fzf)"
- menucmd="fzf"
-fi
+program="$(commander -r -c -d)"
-test -z "$program" && exit 1
+[ "$program" ] || exit 1
-if $program --help > "$OPTIONS"
-then
- option="$(grep "^ *-[-a-zA-Z0-9]* " "$OPTIONS" |
- tr -s ' ' |
- sort |
- uniq |
- column -l 2 -t |
- $menucmd |
- awk '{print $1}')"
-fi
+option="$("$program" --help |
+ # Parse options
+ grep "^ *-[-a-zA-Z0-9]* " |
+ tr -s ' ' |
+ sort | uniq |
+ column -l 2 -t |
+ commander -l -x -c -d |
+ awk '{print $1}')"
-test -z "$option" && exit 1
+[ "$option" ] || exit 1
-rm -f "$OPTIONS"
-setsid $program $option
+setsid "$program" "$option"