mirror of
https://github.com/FliegendeWurst/tmux-thumbs.git
synced 2024-11-22 12:54:59 +00:00
sh: Fix more quoting
This adds quotes where necessary and removes quotes where entirely redundant (like literals).
This commit is contained in:
parent
a0548965f8
commit
85de58b48e
@ -5,24 +5,26 @@ CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|||||||
PARAMS=()
|
PARAMS=()
|
||||||
|
|
||||||
function add-boolean-param {
|
function add-boolean-param {
|
||||||
VALUE=$(tmux show -vg @thumbs-$1 2> /dev/null)
|
local opt value
|
||||||
|
opt="${1}"
|
||||||
if [[ "${VALUE}" == "1" ]]; then
|
value="$(tmux show -vg "@thumbs-${opt}" 2> /dev/null)"
|
||||||
PARAMS+=("--$1")
|
if [ "${value}" = 1 ]; then
|
||||||
|
PARAMS+=("--${opt}")
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function add-option-param {
|
function add-option-param {
|
||||||
VALUE=$(tmux show -vg @thumbs-$1 2> /dev/null)
|
local opt value
|
||||||
|
opt="${1}"
|
||||||
if [ -n "${VALUE}" ]; then
|
value="$(tmux show -vg "@thumbs-${opt}" 2> /dev/null)"
|
||||||
PARAMS+=("--$1=${VALUE}")
|
if [ -n "${value}" ]; then
|
||||||
|
PARAMS+=("--${opt}=${value}")
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
add-option-param "command"
|
add-option-param command
|
||||||
add-option-param "upcase-command"
|
add-option-param upcase-command
|
||||||
add-boolean-param "osc52"
|
add-boolean-param osc52
|
||||||
|
|
||||||
# Remove empty arguments from PARAMS.
|
# Remove empty arguments from PARAMS.
|
||||||
# Otherwise, they would choke up tmux-thumbs when passed to it.
|
# Otherwise, they would choke up tmux-thumbs when passed to it.
|
||||||
@ -32,6 +34,6 @@ done
|
|||||||
|
|
||||||
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
${CURRENT_DIR}/target/release/tmux-thumbs --dir "${CURRENT_DIR}" "${PARAMS[@]}"
|
"${CURRENT_DIR}/target/release/tmux-thumbs" --dir "${CURRENT_DIR}" "${PARAMS[@]}"
|
||||||
|
|
||||||
true
|
true
|
||||||
|
Loading…
Reference in New Issue
Block a user