Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shfmt pre-commit hook fails on files with spaces in path #102

Open
robert914 opened this issue Mar 18, 2022 · 0 comments
Open

shfmt pre-commit hook fails on files with spaces in path #102

robert914 opened this issue Mar 18, 2022 · 0 comments

Comments

@robert914
Copy link

robert914 commented Mar 18, 2022

The shfmt pre-commit hook fails if the file path contains spaces. The issue is that these lines in: https://github.com/jumanjihouse/pre-commit-hooks/blob/master/pre_commit_hooks/shfmt

readonly cmd="shfmt -w $*"
echo "[RUN] ${cmd}"
${cmd}

should probably instead be something like:

readonly cmd=(shfmt "-w" "$@")
echo "[RUN] ${cmd[@]}"
"${cmd[@]}"

To properly handle spaces in paths. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant