rewrite to abolute paths
This commit is contained in:
parent
d818a2a431
commit
5797c693c4
21
run.sh
21
run.sh
@ -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[@]}"
|
||||
Loading…
x
Reference in New Issue
Block a user