mission-control/scripts/lib/gantt_cli.sh

31 lines
686 B
Bash
Executable File

#!/bin/bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
MISSION_CONTROL_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
GANTT_BOARD_DIR="${GANTT_BOARD_DIR:-$MISSION_CONTROL_ROOT/../gantt-board}"
resolve_cli_script() {
local script_name="$1"
local script_path="$GANTT_BOARD_DIR/scripts/$script_name"
if [[ ! -x "$script_path" ]]; then
echo "Missing executable: $script_path" >&2
echo "Set GANTT_BOARD_DIR to your gantt-board project root." >&2
exit 1
fi
echo "$script_path"
}
run_gantt_cli() {
local script_name="$1"
shift || true
local script_path
script_path="$(resolve_cli_script "$script_name")"
"$script_path" "$@"
}