just: Use bash to perform install-hook confirmation
The `[confirm()]` tag had issues on linux with string interpolation, switches to using a bash based read for confirmation.
This commit is contained in:
parent
1f4de60bac
commit
69ccabacdd
3
justfile
3
justfile
|
|
@ -148,10 +148,11 @@ verify-tool tool package_name="":
|
||||||
#
|
#
|
||||||
# Install git hooks
|
# Install git hooks
|
||||||
[group('hooks')]
|
[group('hooks')]
|
||||||
[confirm("Overwrite existing hooks '" + hooks + "'?")]
|
|
||||||
install-hooks:
|
install-hooks:
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -e
|
||||||
|
read -p "Overwrite existing hooks '{{hooks}}'? [y/N] " confirm
|
||||||
|
[[ "$confirm" == "y" ]] || exit 1
|
||||||
for hook in {{hooks}}; do
|
for hook in {{hooks}}; do
|
||||||
if [ -f ".git/hooks/$hook" ]; then
|
if [ -f ".git/hooks/$hook" ]; then
|
||||||
rm ".git/hooks/$hook"
|
rm ".git/hooks/$hook"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue