2019-02-04 21:40:45 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2020-07-29 18:35:42 +00:00
|
|
|
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
|
|
2019-11-23 22:47:16 +00:00
|
|
|
PARAMS=()
|
|
|
|
|
2020-07-29 18:34:25 +00:00
|
|
|
function get-option() {
|
|
|
|
tmux show -vg "@thumbs-${1}" 2> /dev/null
|
|
|
|
}
|
|
|
|
|
2020-05-30 15:45:37 +00:00
|
|
|
function add-boolean-param {
|
2020-07-29 18:34:25 +00:00
|
|
|
local opt
|
2020-07-29 18:30:06 +00:00
|
|
|
opt="${1}"
|
2020-07-29 18:34:25 +00:00
|
|
|
if [ "$(get-option "${opt}")" = 1 ]; then
|
2020-07-29 18:30:06 +00:00
|
|
|
PARAMS+=("--${opt}")
|
2020-05-30 15:45:37 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2019-11-23 22:47:16 +00:00
|
|
|
function add-option-param {
|
2020-07-29 18:30:06 +00:00
|
|
|
local opt value
|
|
|
|
opt="${1}"
|
2020-07-29 18:34:25 +00:00
|
|
|
value="$(get-option "${opt}")"
|
2020-07-29 18:30:06 +00:00
|
|
|
if [ -n "${value}" ]; then
|
|
|
|
PARAMS+=("--${opt}=${value}")
|
2019-03-20 23:31:28 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-07-29 18:30:06 +00:00
|
|
|
add-option-param command
|
|
|
|
add-option-param upcase-command
|
|
|
|
add-boolean-param osc52
|
2019-11-23 22:47:16 +00:00
|
|
|
|
|
|
|
# Remove empty arguments from PARAMS.
|
|
|
|
# Otherwise, they would choke up tmux-thumbs when passed to it.
|
|
|
|
for i in "${!PARAMS[@]}"; do
|
|
|
|
[ -n "${PARAMS[$i]}" ] || unset "PARAMS[$i]"
|
|
|
|
done
|
2019-03-09 22:39:16 +00:00
|
|
|
|
2019-03-10 09:45:22 +00:00
|
|
|
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
2019-03-05 08:10:41 +00:00
|
|
|
|
2020-07-29 18:30:06 +00:00
|
|
|
"${CURRENT_DIR}/target/release/tmux-thumbs" --dir "${CURRENT_DIR}" "${PARAMS[@]}"
|
2020-01-20 19:49:38 +00:00
|
|
|
|
|
|
|
true
|