-
Notifications
You must be signed in to change notification settings - Fork 60
/
matrix-commander-tui
executable file
·32 lines (28 loc) · 1.38 KB
/
matrix-commander-tui
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
27
28
29
30
31
32
#!/usr/bin/env bash
# vipe (from moreutils) must be installed
type vipe >/dev/null 2>&1 || {
echo "This script requires that you install \"vipe\" from the packge \"moreutils\"."
echo "Read https://www.putorius.net/moreutils.html for installation instructions."
echo "As an alternative you could also install \"vipe.sh\" from https://github.com/0mp/vipe.sh/blob/master/vipe.sh."
exit 0
}
# fzf must be installed
type fzf >/dev/null 2>&1 || {
echo "This script requires that you install \"fzf\"."
echo "Read https://github.com/junegunn/fzf#installation for installation instructions."
exit 0
}
# Instruction on how to use fzf
echo "Set env variables EDITOR and VISUAL to change the editor being used."
echo "Use tab to select the correct arguments in the correct order."
sleep 1
# generate the short command options list
# run it throu fzf, run it through editor, execute it
# shellcheck disable=SC2046 # quoting will
PATH=".:matrix_commander/:$PATH" matrix-commander --manual |
grep -E "^ -" | awk -F ' ' '{print $2}' | sed "s/.*, //g" | sort |
echo -n "matrix-commander $(fzf -m)" | xargs | vipe | /bin/bash
# to force a specific editor do this: e.g. forcing to use "nano"
# PATH=".:matrix_commander/:$PATH" matrix-commander --manual |
# grep -E "^ -" | awk -F ' ' '{print $2}' | sort |
# echo -n echo $(fzf -m) | EDITOR=nano VISUAL=nano vipe | /bin/bash