rewrite to abolute paths

This commit is contained in:
Kyattsukuro 2026-03-27 23:22:23 +01:00
parent d818a2a431
commit 5797c693c4

21
run.sh
View File

@ -2,6 +2,25 @@
SCRIPT_DIR="$HOME/.config/fledermaus-formatter"
to_absolute_args() {
local result=()
for arg in "$@"; do
if [ -e "$arg" ] || [ -d "$arg" ] || [ -f "$arg" ]; then
result+=("$(realpath "$arg")")
else
result+=("$arg")
fi
done
printf '%s\n' "${result[@]}"
}
ABS_ARGS=()
while IFS= read -r line; do
ABS_ARGS+=("$line")
done < <(to_absolute_args "$@")
cd $SCRIPT_DIR
source $SCRIPT_DIR/.venv/bin/activate
$SCRIPT_DIR/.venv/bin/python3 __init__.py $@
$SCRIPT_DIR/.venv/bin/python3 __init__.py "${ABS_ARGS[@]}"