33 lines
1.4 KiB
Bash
Executable File
33 lines
1.4 KiB
Bash
Executable File
#!/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
|