mirror of
https://github.com/FliegendeWurst/tmux-thumbs.git
synced 2024-11-22 12:54:59 +00:00
sh: Factor out option name querying
This commit is contained in:
parent
85de58b48e
commit
27b0214408
@ -4,11 +4,14 @@ CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|||||||
|
|
||||||
PARAMS=()
|
PARAMS=()
|
||||||
|
|
||||||
|
function get-option() {
|
||||||
|
tmux show -vg "@thumbs-${1}" 2> /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
function add-boolean-param {
|
function add-boolean-param {
|
||||||
local opt value
|
local opt
|
||||||
opt="${1}"
|
opt="${1}"
|
||||||
value="$(tmux show -vg "@thumbs-${opt}" 2> /dev/null)"
|
if [ "$(get-option "${opt}")" = 1 ]; then
|
||||||
if [ "${value}" = 1 ]; then
|
|
||||||
PARAMS+=("--${opt}")
|
PARAMS+=("--${opt}")
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -16,7 +19,7 @@ function add-boolean-param {
|
|||||||
function add-option-param {
|
function add-option-param {
|
||||||
local opt value
|
local opt value
|
||||||
opt="${1}"
|
opt="${1}"
|
||||||
value="$(tmux show -vg "@thumbs-${opt}" 2> /dev/null)"
|
value="$(get-option "${opt}")"
|
||||||
if [ -n "${value}" ]; then
|
if [ -n "${value}" ]; then
|
||||||
PARAMS+=("--${opt}=${value}")
|
PARAMS+=("--${opt}=${value}")
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user