-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·50 lines (39 loc) · 1.03 KB
/
Copy pathstart.sh
File metadata and controls
executable file
·50 lines (39 loc) · 1.03 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env bash
set -Eeuo pipefail
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BINARY="${CURRENT_DIR}/build/magonote-tmux"
get_opt_value() {
tmux show -vg "@magonote-${1}" 2>/dev/null || true
}
get_opt_arg() {
local opt="$1"
local type="$2"
local value
value="$(get_opt_value "${opt}")"
if [[ "${type}" == "string" ]]; then
[[ -n "${value}" ]] && echo "--${opt} ${value}"
elif [[ "${type}" == "boolean" ]]; then
[[ "${value}" == "1" ]] && echo "--${opt}"
else
return 1
fi
}
PARAMS=(--dir "${CURRENT_DIR}/build/")
add_param() {
local opt="$1"
local type="$2"
local value
value="$(get_opt_value "${opt}")"
if [[ -n "${value}" ]]; then
if [[ "${type}" == "string" ]]; then
PARAMS+=("--${opt}" "${value}")
elif [[ "${type}" == "boolean" && "${value}" == "1" ]]; then
PARAMS+=("--${opt}")
fi
fi
}
add_param command string
add_param upcase-command string
add_param multi-command string
add_param osc52 boolean
"${BINARY}" "${PARAMS[@]}" || true