26 lines
517 B
Bash
Executable File
26 lines
517 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
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 "${ABS_ARGS[@]}" |